php - url returns XML on browser, but doesn't when using cURL -


i'm sending few parameters, via post url using curl, url supposed return results in xml, instead returns string result.

if copy url , variables , paste in browser, returns desired xml.

        $ch = curl_init();         curl_setopt($ch, curlopt_url,$url);         curl_setopt($ch, curlopt_post, true);         curl_setopt($ch, curlopt_postfields, $variables);         curl_setopt($ch, curlopt_ssl_verifyhost, false);         curl_setopt($ch, curlopt_ssl_verifypeer, false);         curl_setopt($ch, curlopt_returntransfer, true);         curl_setopt($ch, curlopt_header, false);         $result = curl_exec($ch);         $error = curl_error($ch);         curl_close($ch);         print_r($result); 

that's piece of code i'm using. missing something?

thanks in advance.

take string curl returns , turn xml object

$xml = simplexml_load_string($result); 

simplexml documentation here


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -