2017-03-05 56 views
0

我想蜷縮https://www.chenyutv.com/ceshi/yunapi.php?v=58ae49f50cf2d11b00b4fce1捲曲網址返回有線輸出

在終端,它返回:

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

所以這是basicly一般的XML文件。

但是,如果我不捲曲在PHP或使蟒蛇的要求,我不能得到任何東西。

你能解釋一下嗎?

謝謝。

我的PHP代碼在這裏:

$url = "https://www.chenyutv.com/ceshi/yunapi.php?v=58ae49f50cf2d11b00b4fce1&type=mp4"; 
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_URL, $url); 
curl_setopt($curl, CURLOPT_FAILONERROR,1); 
// curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 
//followlocation cause infinite waiting time. 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
$data=curl_exec($curl); 
curl_close($curl); 
echo $data; 
+0

「https://www.chenyutv.com/ceshi/yunapi.php?v=58ae49f50cf2d11b00b4fce1&type=mp4」 是否重定向,可以在會導致它 – 2017-03-05 04:57:45

回答

0

你捲曲$url變量&type=mp4末(https://www.chenyutv.com/ceshi/yunapi.php?v=58ae49f50cf2d11b00b4fce1&類型= 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