1

我正在尝试使用 curl 获取 vimeo 视频的网页,但我得到了http-code 301. 我也添加了CURLOPT_FOLLOWLOCATION,但我什么也没得到。

这是我的代码,为什么它不起作用?

function getremote($url) {
    $agent="spider";
    $ch=curl_init();
    curl_setopt($ch,CURLOPT_HEADER,true);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
    curl_setopt($ch,CURLOPT_AUTOREFERER,true);
    $html=curl_exec($ch);
    print_r(curl_getinfo($ch,CURLINFO_EFFECTIVE_URL));
    print_r(curl_getinfo($ch));
    curl_close($ch);
    return $html;
}
$json_errors=array();
$ul="vimeo.com/124182657";;
$content=getremote($ul);
4

0 回答 0