Php 网页搜索列表

Php 网页搜索列表,php,search,curl,echo,Php,Search,Curl,Echo,我在txt中单独列出了http \n 我想通过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 SPE

我在txt中单独列出了http \n 我想通过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";
}

在url上进行分解,如: $urls=分解('\n',urlstring)

现在,您可以在URL数组中循环。


<?
$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;  

}
?>

最后,array$result包含文本文件中链接的所有html

Google for
PHP preg\u match\u all