0
我試圖從這個URL下載一個文件在PHP:http://www.roblox.com/Asset/BodyColors.ashx?userId=36377783如何使用php從.ashx頁面下載文件?
該頁面返回一個文件,您的瀏覽器自動下載。
我試圖使用捲曲:
<?php
$uid = 36377783;
$xUrl = "http://www.roblox.com/Asset/BodyColors.ashx?userId=".$uid;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $xUrl);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$xml = curl_exec($ch);
curl_close($ch);
echo $xml;
?>
但它重定向我到一個錯誤頁面。
如何下載.ashx url返回的文件?
(設置CURLOPT_USERAGENT不起作用。)