回覆列表
  • 1 # 不忘初心繼續前進144738137

    //採集首頁地址

    $url="http://emotion.pclady.com.cn/skills/";

    //獲取頁面程式碼

    $rs=file_get_contents($url);

    //設定匹配正則

    //$fp=fopen("text.txt","a");

    //$fw=fwrite($fp,$rs);

    //fclose($fp);

    /*<I class=titles><A

    target=_blank>留住你身邊的好男人</A></I>*/

    //進行正則搜尋

    preg_match_all($preg,$rs,$title);

    //計算標題數量

    $count=count($title[0]);

    echo $count."<br>";

    //透過標題數量進行內容採集

    for ($i=0;$i<$count;$i++){

    //設定內容頁地址

    preg_match_all($pr,$title[0][$i],$jurl);

    $substr=substr($jurl[0][0],9);

    $curl=substr($substr,0,-18);

    //獲取內容頁程式碼

    $c=file_get_contents($curl);

    //設定內容頁匹配正則

    //進行正則匹配搜尋

    preg_match($pc,$c,$content);

    //輸出標題

    echo $title[0][$i]."<br>";

    echo $title[1][$i]."<br>";

    $concount=count($content[0]);

    echo $concount."<br>";

    echo $content[0][0];

    for ($j=0;$j<$concount;$j++){

    }

    }

  • 中秋節和大豐收的關聯?
  • 雷電等災害性天氣如何做好防範工作?