Start New Discussion within our Web Development Community

Hi There,

I have a usage problem with CURL output.

I have a web services and I use CURL to get the data, However this web services set up as XML output and I want to convert it to array to use the result in the web form.

My CURL is

$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, '');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt ($ch, CURLOPT_POSTFIELDS ,"cnum=$cnum");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

$file_contents = htmlspecialchars(curl_exec($ch));

echo $file_contents;

I have the output;

<?xml version="1.0" encoding="utf-8"?>
	<role code="BNA" name="Branch Advertising ">N</role>
	<role code="BEC" name="Branch Caesarean Contact">N</role>
	<role code="BC" name="Branch Co-ordinator / Chair">N</role>
	<role code="BW" name="Branch Web Co-ordinator">N</role>

And I want to use this result in a form with check boxes..

Does anybody have an idea?

Thank You

This question has already been answered. Start a new discussion instead.