sim*_*mon 4 php xml post simplexml
我正在尝试编写一个PHP脚本,将POST请求发送到远程服务器,然后解析XML响应.
我可以做POST请求,但是很难(从其他SO问题)解决如何解析XML响应.
我目前的代码给了我:Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "1" in /Users/simon/usercreate.php on line 46- simplexml_load_file($response)线.
我正在使用本地服务器,不确定这是否有所作为.码:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
$response = curl_exec ($curl);
curl_close ($curl);
echo $response;
$rxml = simplexml_load_file($response);
echo $rxml->title;
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?