Python curl url返回有线输出
我正试着卷曲 在终端中,它返回:Python curl url返回有线输出,python,php,curl,Python,Php,Curl,我正试着卷曲 在终端中,它返回: <?xml version="1.0" encoding="UTF-8"?><xml_player xxx="2017-03-05 12:33:26"><flashvars>{h->{f->http://www.chenyutv.com/ceshi/yunapi.php?v=[$pat]}</flashvars><video><file><![CDATA[http://60
<?xml version="1.0" encoding="UTF-8"?><xml_player xxx="2017-03-05 12:33:26"><flashvars>{h->{f->http://www.chenyutv.com/ceshi/yunapi.php?v=[$pat]}</flashvars><video><file><![CDATA[http://60.205.15.71/cloudvideo/kservice-route/get.json?timestamp=1488688314&fid=400204000058AE4DDA00010018300000000000-0000-0000-0145-D57400000000.mp4&ns=video.acfun.cn&vid=58ae49f50cf2d11b00b4fce1&customer_id=5859fdaee4b0eaf5dd325b91&sign=ct58bb94ba0cf2491566baf4d8&oip=771245519&sid=448867538455088ad3c71&token=5691&did=780d9eb79b7fdf85b68434127182f844&ev=1&ctype=87&ep=OMpK5RGtKUHkeqthQ%2B40fg1UQyLtXABpM1HaBsEEW1n9hVy1ygJV6FndJZu8DVQ5A6tYHzbS%2BeYMiwIF%2BhzDVUhAdNQESISyQSRVHTpuS92pf4cob9CNE04QHcmbTu2P&skuid=qq387673116]]></file><size>318946771</size><seconds>6192</seconds></video></xml_player>
cURL
$url
变量的末尾有&type=mp4
(https://www.chenyutv.com/ceshi/yunapi.php?v=58ae49f50cf2d11b00b4fce1
&type=mp4)。该URL的卷曲不会返回任何数据,但您提到的第一个URL的卷曲是有效的
$url = "https://www.chenyutv.com/ceshi/yunapi.php?v=58ae49f50cf2d11b00b4fce1"; // without &type=mp4
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FAILONERROR,1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data=curl_exec($curl);
curl_close($curl);
echo $data; // returns the xml content
“”是否重定向,可能是由于
$url = "https://www.chenyutv.com/ceshi/yunapi.php?v=58ae49f50cf2d11b00b4fce1"; // without &type=mp4
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FAILONERROR,1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data=curl_exec($curl);
curl_close($curl);
echo $data; // returns the xml content