Advertisement
oquidave

xml_curl

May 21st, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. SENDING END
  2. /*
  3. * post xml data to a smsmedia sms gateway api
  4. */
  5.  
  6. $xml = <<<EOD
  7. <?xml version="1.0" encoding="UTF-8"?>
  8. <SENDBATCH user='username' password='password' application='50' reply='EMAIL:dokwii@smsmedia.info'>
  9. This is from parsed xml
  10. <SMSLIST>
  11. <SMS_SEND to='256712087736' uid='1'/>
  12. <SMS_SEND to='256791040262' uid='2'/>
  13. <SMS_SEND to='256754819815' uid='3'/>
  14. <SMS_SEND to='256754819814' uid='4'/>
  15. </SMSLIST>
  16. </SENDBATCH>
  17. EOD;
  18.  
  19. $ch = curl_init();
  20. curl_setopt($ch, CURLOPT_HEADER, 0);
  21. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  22. //$url = 'smsxml.php';
  23. //$url = 'http://localhost:10088/travelport_dev/smsxml.php';
  24. $url = "http://lambda.smsmedia.ug/travelport";
  25. curl_setopt($ch, CURLOPT_URL, $url);
  26. curl_setopt($ch, CURLOPT_POST, 1);
  27. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
  28. //curl_setopt($ch, CURLOPT_POSTFIELDS, "XML=".$xmlcontent."&password=".$password."&etc=etc");
  29. curl_setopt($ch, CURLOPT_POSTFIELDS, "XML=$xml");
  30. //curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
  31. $content=curl_exec($ch);
  32. $info = curl_getinfo($ch);
  33. curl_close($ch);
  34.  
  35.  
  36. RECEIVING END
  37.  
  38. //get xml data
  39. $xml = simplexml_load_file("php://input");
  40. //instantiate our xml parser
  41. $xmlparser = new MyXmlParser($xml);
  42. //get the root attributes
  43. $root_att = $xmlparser->GetRootAttributes();
  44. //authenticate this application from the db
  45.  
  46. //get phone numbers and uids arrays
  47. list($phone_no_arr, $uid_arr) = $xmlparser->GetPhoneUid();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement