Hello Friends,
plz anybody help in finding out this, i need help in webservices with php using nusoap method. iam new working on this webservices, plz anybody help me.
here is the code written,
<?php
/*
* This gets the list of methods
*/
$client = new SoapClient("http://204.15.103.87/MCM/Messaging?wsdl", array('trace'=>1));
$func_list = $client->__getFunctions();
foreach ($func_list as $key => $value)
{
echo $key;
echo $value;
echo "<br>";
}
echo "<b>Validate Mobile Number</b>";
$res = $client->validateMobileNumber("raju","raju123","+16507031742 / +16508635093");
echo $res->statusMessage;
echo "<br><b>Send Message</b><br>";
$res1 = $client->sendMessage("raju","raju123",'+16507031742/+16508635093',"uday",81893);
foreach ($res1->collection as $key => $value)
{
print "<b>" . $value->groupId;echo "--------";
print $value->groupName;echo "</b><br>";
}
echo "<br><b>Get Message Status</b><br>";
$res2 = $client->getMessageStatus("raju","raju123",'+16507031742/+16508635093',"uday",81893);
foreach ($res2->collection as $key => $value)
{
print "<b>" . $value->groupId;echo "--------";
print $value->groupName;echo "</b><br>";
}
/*
* sends text messages , parameters required are string $userId, string $mobileNumber, string $message, long $siteId, string $senderName
and returns messageId
*/
//takes message id as parameter and returns the status.
$res3 = $client->getMessageStatus("52016");
//var_export($res2);
echo $res3->statusMessage;
//echo "<br>";
$test = serialize($res);
$t = unserialize($test);
?>
while executing this it showing errors like this.
Warning: SoapClient::SoapClient(http://204.15.103.87/MCM/Messaging?wsdl) [soapclient.soapclient]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in C:\xampp\htdocs\webservices\test.php on line 6
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "http://204.15.103.87/MCM/Messaging?wsdl" in C:\xampp\htdocs\webservices\test.php on line 6
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://204.15.103.87/MCM/Messaging?wsdl' in C:\xampp\htdocs\webservices\test.php:6 Stack trace: #0 C:\xampp\htdocs\webservices\test.php(6): SoapClient->SoapClient('http://204.15.1...', Array) #1 {main} thrown in C:\xampp\htdocs\webservices\test.php on line 6