>我在 txt 中分别列出了 http 列表 '我希望通过php卷曲每个页面并搜索指定字符串
具体字符串为:
http://www.....com/xyz/...png or .gif
$ch = curl_init("ARRAY of page from txt????");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$text = curl_exec($ch);
$test = strpos($text, "HOW CREATE THE SPECIFIC STRING???");
if ($test==false)
{
echo $test;
}
else
{
echo "no exist";
}
<?
$array = explode("'n", file_get_contents('fileName.txt'));
foreach($array as $url){
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "example.com");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
$result[] = $output;
}
?>
最后,数组$result包含文本文件中链接的所有HTML
在网址上做一个爆炸,就像:$urls = 爆炸(''',网址字符串)
现在,您可以遍历 url 数组。