0
這裏我的代碼,如何獲得curl響應以在php中獲取特定標記?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close ($ch);
print_r($response);
我得到響應這樣
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
<mediaid>af11zj</mediaid>
<mediaurl>http://yfrog.com/af11zj</mediaurl>
</rsp>
如何獲取mediaurl?任何人幫助我?謝謝。
嘗試使用XML解析器。例如:SimpleXML [http://php.net/simplexml] – Fracsi
我只是要求得到mediaurl @Prisoner –