HTTP请求失败!PHP中的HTTP/1.1 416
我有这个代码,链接行中有一个错误HTTP请求失败!PHP中的HTTP/1.1 416,php,Php,我有这个代码,链接行中有一个错误 $link = file_get_contents("http://www.manta.com/search?search=store&pg=1"); $file = strip_tags($link, "<span>"); if(preg_match_all('/<span itemprop="streetAddress">(?:[^<]*)<\/span>/is', $file, $content,
$link = file_get_contents("http://www.manta.com/search?search=store&pg=1");
$file = strip_tags($link, "<span>");
if(preg_match_all('/<span itemprop="streetAddress">(?:[^<]*)<\/span>/is', $file, $content, PREG_PATTERN_ORDER)){
/*$final = print_r($content, true);
echo $final;
*/
$i = 0;
if(!empty($content[0][$i])){
while(!empty($content[0][$i])){
echo $content[0][$i];
$i++;
}
}
}
我只想从该站点获取商店地址。如果它需要一个范围,则不能执行普通的f_g_c()调用。您必须添加适当的range头,这意味着首先设置一个流,或者使用curl。如果它需要一个range,那么您不能执行普通的f_g_c()调用。您必须添加适当的范围标头,这意味着首先设置流,或者使用curl。
Warning: file_get_contents(http://www.manta.com/search?search=store&pg=1): failed to open stream: HTTP request failed! HTTP/1.1 416 Requested Range Not Satisfiable on line 17.