Sending XML data using HTTP POST with PHP -
i need send xml
<?xml version="1.0" encoding="utf-8"?> <gate> <country>no</country> <accessnumber>1900</accessnumber> <sendernumber>1900</sendernumber> <targetnumber>4792267523</targetnumber> <price>0</price> <sms> <content><![cdata[this test æøå ÆØÅ]]></content> </sms> </gate>
to sms gateway service. service listens http post requests. xml must embedded in body of post request.
i'm using php , codeigniter framework, i'm total php n00b, ideally i'd need thorough guide, pointers in right direction appreciated.
you can use curl library posting data: http://www.php.net/curl
$ch = curl_init(); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_url, "http://websiteurl"); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, "xml=".$xmlcontent."&password=".$password."&etc=etc"); $content=curl_exec($ch);
where postfield contains xml need send - need name postfield api service (clickatell guess) expects
Comments
Post a Comment