Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

PHP/API CURL&HTTPS Jasper Send SMS

Newbie Spellweaver
Joined
Jan 14, 2015
Messages
9
Reaction score
0
Hi all.
I'm trying to make script for website that use php/api (curl&https) on jasperwireless

there is example from cp

PHP:
<?php
require_once('nusoap.php');

$JASPER_URI = 'http://api.jasperwireless.com/ws/schema';

$env = 'apitest'; # Apitest URL. See "Get WSDL Files" in the API documentation for Production URL.
$wsdlUrl = 'http://'.$env.'.jasperwireless.com/ws/schema/Terminal.wsdl';
$licenseKey = '<INSERT LICENSE KEY HERE>';
$userName = '<INSERT USER NAME HERE>';
$password = '<INSERT PASSWORD HERE>';

$service = new nusoap_client($wsdlUrl, true /** wsdl **/);
$service->setHeaders(
'<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">'.
'<wsse:UsernameToken>'.
'<wsse:Username>'.$userName.'</wsse:Username>'.
'<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">'.$password.'</wsse:Password>'.
'</wsse:UsernameToken>'.
'</wsse:Security>'
);
$msg =
'<GetTerminalDetailsRequest xmlns="'.$JASPER_URI.'">'.
'<messageId></messageId>'.
'<version></version>'.
'<licenseKey>'.$licenseKey.'</licenseKey>'.
'<iccids>'.
'<iccid>'.'INSERT ICCID HERE'.'</iccid>'.
'<iccid>'.'INSERT ANOTHER ICCID HERE'.'</iccid>'.
'</iccids>'.
'</GetTerminalDetailsRequest>';
$result = $service->call('GetTerminalDetails', $msg);

if ($service->fault) {
  echo 'faultcode: ' . $service->faultcode . "\n";
  echo 'faultstring: ' . $service->faultstring . "\n";
  echo 'faultDetail: ' . $service->faultdetail . "\n";
  echo 'response: ' . $service->response;
  exit(0);
}

echo 'Request: ' . $service->request . "\n";
echo 'Response: ' . $service->response . "\n";
echo "Call result: \n";
var_dump($result['terminals']['terminal']);
echo "Status of the first terminal: " . $result['terminals']['terminal'][0]['status'] . "\n";
?>

this is wsdl for sms

and this sms schema

Code:
[COLOR=#000000]<soapenv:Envelope xmlns:soapenv="[/COLOR][URL="http://schemas.xmlsoap.org/soap/envelope/%22"]http://schemas.xmlsoap.org/soap/envelope/"[/URL][COLOR=#000000]xmlns:sch="[/COLOR][URL="http://api.jasperwireless.com/ws/schema%22"]http://api.jasperwireless.com/ws/schema"[/URL][COLOR=#000000]>[/COLOR]
[COLOR=#000000]<soapenv:Header>[/COLOR]
[COLOR=#000000]<wsse:Security xmlns:wsse="[/COLOR][URL="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd%22"]http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"[/URL][COLOR=#000000]>[/COLOR]
[COLOR=#000000]<wsse:UsernameToken xmlns:wsu="[/COLOR][URL="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd%22"]http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"[/URL][COLOR=#000000]>[/COLOR]
[COLOR=#000000]<wsse:Username>?</wsse:Username>[/COLOR]
[COLOR=#000000]<wsse:Password Type="[/COLOR][URL="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText""]http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"[/URL][COLOR=#000000]>?</wsse:Password>[/COLOR]
[COLOR=#000000]</wsse:UsernameToken>[/COLOR]
[COLOR=#000000]</wsse:Security>[/COLOR]
[COLOR=#000000]</soapenv:Header>[/COLOR]
[COLOR=#000000]<soapenv:Body>[/COLOR]
[COLOR=#000000]      <sch:SendSMSRequest messageTextEncoding="LITERAL">[/COLOR]
[COLOR=#000000]         <sch:messageId>1.0</sch:messageId>[/COLOR]
[COLOR=#000000]         <sch:version>1.0</sch:version>[/COLOR]
[COLOR=#000000]         <sch:licenseKey>?</sch:licenseKey>[/COLOR]
[COLOR=#000000]         <sch:sentToIccid>?</sch:sentToIccid>[/COLOR]
[COLOR=#000000]         <sch:messageText>?</sch:messageText>[/COLOR]
[COLOR=#000000]         <!--Optional:-->[/COLOR]
[COLOR=#000000]      </sch:SendSMSRequest>[/COLOR]
[COLOR=#000000]   </soapenv:Body>[/COLOR]
[COLOR=#000000]</soapenv:Envelope>[/COLOR]

so have i understand code need to looks like that?

<?php
require_once('nusoap.php');

$JASPER_URI = 'http://api.jasperwireless.com/ws/schema';

$env = 'apitest'; # Apitest URL. See "Get WSDL Files" in the API documentation for Production URL.
$wsdlUrl = 'http://'.$env.'.jasperwireless.com/ws/schema/Sms.wsdl';
$licenseKey = '<INSERT LICENSE KEY HERE>';
$userName = '<INSERT USER NAME HERE>';
$password = '<INSERT PASSWORD HERE>';

$service = new nusoap_client($wsdlUrl, true /** wsdl **/);
$service->setHeaders(
'<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">'.
'<wsse:UsernameToken>'.
'<wsse:Username>'.$userName.'</wsse:Username>'.
'<wsse:password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">'.$password.'</wsse:password>'.
'</wsse:UsernameToken>'.
'</wsse:Security>'
);
$msg =

'<SendSMSRequest messageTextEncoding="LITERAL">'.
'<messageId>'.'1.0'.'</messageId>'.
'<version>'.'1.0'.'</version>'.
'<licenseKey>'.'215125-12523523-124aweq'.'</licenseKey>'. '<sentToIccid>'.'25825723857325832'.'</sentToIccid>'.
'<messageText>'.'message text'.'</messageText>'.
'</SendSMSRequest>';

$result = $service->call('GetTerminalDetails', $msg);

if ($service->fault) {
echo 'faultcode: ' . $service->faultcode . "\n";
echo 'faultstring: ' . $service->faultstring . "\n";
echo 'faultDetail: ' . $service->faultdetail . "\n";
echo 'response: ' . $service->response;
exit(0);
}

------> ??????????

echo 'Request: ' . $service->request . "\n";
echo 'Response: ' . $service->response . "\n";
echo "Call result: \n";
var_dump($result['terminals']['terminal']);
echo "Status of the first terminal: " . $result['terminals']['terminal'][0]['status'] . "\n";

<---- and there?
?>

i think someone understand this if need i can give sources of c/c# but i dont understand nothing from c & c#

when i tryed this codes, i get error, license key, username , password are incorrect maybe cuz i dont have https and not secured my connections...

if someone really helps me i can pay a little bit :)

thank you.
 
Back
Top