当我从网址文件中读取网址并将其传递给file_get_html()
方法时,我收到此错误...
Warning: file_get_contents(http://www.xxxxxxx.ir/brand/perfume/Aigner ): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in F:\wamp\www\atr\index.php on line 89
这是我的代码:
$fup=fopen("fileurl.txt","r");//read from the file of urls
$string=fgets($fup);get line from file of urls
$html=file_get_contents("$string");
这是make URL的代码并放入fileurl.txt
:
function mkurl($burl,$furl){
$fup=fopen("fileurl.txt","w");
$fbp=fopen("$furl","r");
while(!feof($fbp)){
$mku=$burl.fgets($fbp);
fwrite($fup,"$mku");
}
fclose($fup);
fclose($fbp);
}
我认为从文件读取和放置有问题
它在file_get_html()
。关于fgets()
和fwrite()
,因为那些会在网址中添加其他字符并导致错误。