Results 1 to 6 of 6
Thread: Webservices PHP CURL Help
Oct 6, 2010, 20:59 #1
- Join Date
- Jan 2010
- 0 Post(s)
- 0 Thread(s)
Webservices PHP CURL Help
I have used the following script to consume REST webservices provided by Commission Junction. I'm able to get the response but the response is not in xml format.
// return xml feed from 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);
echo $response; // will print in browser all country codes in an xml format
ADD YOUR OWN CODE HERE TO DO WHAT YOU WANT WITH THE RESPONSE. MAYBE SAVE RESULTS TO A FILE OR THE PARSE THE RESULTS INTO A DATABASE?
Would someone please have a look at this script and suggest me what I need to do in order to get the response in xml ? I want to save the response in xml file and then process it later.
What I did is just saved the code into php file and opened it using my browser and the output is all text. Am I doing something wrong ?