I am relatively new to PHP. I am trying to display a XML response from a restful Web Service. Below is my code snippet:
<?php
if(isset($_GET['submit'])){
$name = $_GET['company'];
$url = "http://dev.markitondemand.com/MODApis/Api/v2/Lookup/xml?input=$name";
$client = curl_init($url);
curl_setopt($client, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($client);
$xml = new SimpleXMLElement($response);
curl_close($client);
foreach($xml->LookupResultList as $oEntry){
echo $oEntry->LookupResultList->LookupResult[i]->symbol . "
";
}
}
?>
I get the following error in the console:
Invalid request (Unexpected EOF)
Also $xml is blank.