PHP REST webservices Curl help -
i have used following script consume rest webservices provided commission junction. i'm able response response not in xml format.
<?php $targeturl="https://support-services.api.cj.com/v2/countries"; $cj_devkey= "xxxxxxxxx"; // return xml feed cj $ch = curl_init($targeturl); curl_setopt($ch, curlopt_post, false); curl_setopt($ch, curlopt_httpheader, array('authorization: '.$cj_devkey)); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_returntransfer, true); $response = curl_exec($ch); curl_close($ch); echo $response; // print in browser country codes in xml format /* add own code here want response. maybe save results file or parse results database? */ ?>
i'm confused. isn't response when using rest webservices in xml format. please correct me if i'm wrong.
would please have @ script , suggest me need in order response in xml ? want save response in xml file , process later.
from can gather curl doesn't data receives, that's you. need parse how.
a similar question here: php curl, extract xml response
also, response webservice not have xml. it's common, there other formats json, yaml, , html :)
Comments
Post a Comment