2008-11-09 44 views

回答

6

只要閱讀頁面內容,就像閱讀文件一樣。 PHP爲你做連接的東西。然後通過正則表達式或簡單字符串比較來查找字符串。

$url = 'http://my.url.com/'; 
$data = file_get_contents($url); 

if (strpos('maybe baby love you', $data) === false) 
{ 

    // do something 

} 
+2

這應該是「strpos($ data, '也許寶寶愛你');「 [strpos](http://php.net/manual/en/function.strpos.php) – moteutsch 2011-05-24 21:41:43

0

假設的fopen URL封裝上...

​​
0

如果未啓用的fopen URL封裝,您可以使用捲曲模塊(見http://www.php.net/curl

也捲曲讓您能夠處理已驗證的頁面,重定向等。

5
//The Answer No 3 Is good But a small Mistake in the function strpos() I have correction the code bellow. 

$url = 'http://my.url.com/'; 
$data = file_get_contents($url); 

if (strpos($data,'maybe baby love you') === false) 
{ 
    // do something 
}