smaction

JSON Decode 2

Jan 22nd, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. $client = new SoapClient("http://www.scottnichol.com/samples/hellowsdl2.php?wsdl&debug=1",array(
  3. "trace"=>1,
  4. "exceptions"=>0)
  5. );
  6.  
  7. //$req->firstname="Scott";
  8. //$req->age="50";
  9. //$req->gender="M";
  10. //$parameters->person = $req;
  11. $obj = $client->hello(array('firstname'=>"Scott",'age'=>"50",'gender'=>"M"));
  12. //$xml = simplexml_load_string($client->__getLastResponse());
  13. $xml = simplexml_load_string($client->__getLastRequest());
  14. //$xml = new SimplexmlElement($client->__getLastResponse(), TRUE);
  15. $json= json_encode($xml);
  16. //$json= json_encode($client->__getLastResponse());
  17. print "<pre>\n";
  18. print "<br />\n Request : ".htmlspecialchars($client->__getLastRequest());
  19. print "<br />\n Response: ".htmlspecialchars($client->__getLastResponse());
  20.  
  21. print "<br />\n xml: ".$xml;
  22. print "<br />\n JSON: ".$json;
  23. print "</pre>";
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment