0

这是我的代码,

$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>

如何获得该媒体网址?有人帮我吗?谢谢。

4

1 回答 1

0

假设您有响应 XML $response

<?php 
    $obj = simplexml_load_string($response);
    $mediaurl = (string) $obj->mediaurl;
?>
于 2013-06-28T11:34:46.760 回答