This article mainly introduces PHP implementation of Web services methods, interested in the reference of friends, I hope to be helpful to everyone.
This example describes how PHP uses Nusoap to invoke a Web service, as follows:
Steps:
1. Download Nusoap Library from the Internet.
2. Pass parameter list in your $client->call and enjoy.
<?phprequire_once ('./lib/nusoap.php '); $client = new Soapclientnusoap (' http://www.devtrackn.com/webservice/ Server.php '); $err = $client->geterror (); if ($err) {//Display the error echo ' <p><b>constructor error: ' . $err. ' </b></p> '; At this point, you know the follows would fail}////////////////////////////////////////////////////////////// Update_location Method Parameter$param = Array (' Device_number ' = ' 9910948357 ', ' latitude ' = ' 40.727757 ', ' longitude ' = ' -73.984366 ', ' Battery_status ' => ; ' + ');//User_action Method parameter$param2 = Array (' device_number ' = ' 27ab2026da5213ebd6c95e5fbe50965bdfaddf 4b ', ' latitude ' = ' 40.727757 ', ' longitude ' and ' -73.984366 ', ' user_action ' = ' meeting_test ' ///sos Method PARAMETER$PARAM3 = Array (' device_number ' = ' 9910948357 ', ' latitude ' = ' 40.727757 ',' Longitude ' = ' -73.984366 ',);//$result = $client->call (' update_location ', $param);//$result = $client->cal L (' user_action ', $param 2);//$result = $client->call (' SOS ', $param 3); $result = $client->call (' User_entity_ Status ', Array (' device_number ' = ' 27ab2026da5213ebd6c95e5fbe50965bdfaddf4b '));/////////////////////////////// Check for a faultif ($client- >fault) {echo ' <p><b>fault: '; Print_r ($result); Echo ' </b></p> ';} else {//Check for errors $err = $client->geterror (); if ($err) {//Display the error echo ' <p><b>error: '. $err. ' </b></p> '; } else {//Display the result echo "<pre>"; Print_r ($result); echo "</pre>"; }}echo '
Summary : The above is the entire content of this article, I hope to be able to help you learn.
Related recommendations:
PHP traversal method for binary tree
Php+mysql data insertion based on INSERT INTO statement
Types of PHP comparison operators