Php 当我想从.txt文件读取URL时,从简单Html Dom获取错误

Php 当我想从.txt文件读取URL时,从简单Html Dom获取错误,php,simple-html-dom,Php,Simple Html Dom,当我从URL文件读取URL并将其传递到file\u get\u 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("

当我从URL文件读取URL并将其传递到file\u get\u 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");
这是生成URL并放入fileurl.txt的代码:

我想我在读取文件和放置文件时遇到了问题
它位于文件\u get\u html中。关于fgets和fwrite,因为它们在URL中添加了额外的字符并导致错误。

修剪从文件中获得的行,因为您可能会获得任何新的行字符

$string=trim(fgets($fup)); //get line from file of urls
要查看额外的字符,需要遍历字符串并使用ord函数进行分析。 范例


检查ASCII码中的第一个字符和最后一个字符。

…谢谢我的朋友…但现在我想知道它是什么字符?不客气,但我不理解你的问题。我想知道我什么时候在file.txt中输入和获取字符串,添加了什么字符?但现在又出现了另一个错误!php中的最大执行量!如何解决?我编辑了我的答案,包括如何检查ASCII码中的额外字符。我看你现在在问另一个问题,如果有用的话,请考虑接受我的回答。
$string=trim(fgets($fup)); //get line from file of urls
foreach ($string as $char) print ord($char) . ", ";