我試圖從HTML頁面獲取精確的域名網址如何獲取域名網址從頁
我想這個網址從v.html
https://picasaweb.google.com/114948445121686813006/DropBox?authkey=Gv1sRgCMLjxpef1rHJ3QE#5929911272604125650
回來,但我的PHP函數顯示所有URL
v.html有HTML代碼和鏈接
這是我的PHP代碼
<?php
$string=file_get_contents("v.html");
function getUrls($string)
{
$regex = '/https?\:\/\/[^\" ]+/i';
preg_match_all($regex, $string, $matches);
return ($matches[0]);
}
$urls = getUrls($string);
foreach($urls as $url)
{
echo $url.'<br />';
}
?>
輸出
http://www.w3.org/2007/app
http://schemas.google.com/photos/2007
http://www.w3.org/2005/Atom
http://purl.org/atom/app#
http://www.w3.org/2007/app
http://schemas.google.com/photos/2007
http://www.w3.org/2005/Atom
http://purl.org/atom/app#
http://www.w3.org/2007/app
http://www.w3.org/2005/Atom
http://purl.org/atom/app#
http://www.w3.org/2007/app
https://picasaweb.google.com/114948445121686813006/DropBox?authkey=Gv1sRgCMLjxpef1rHJ3QE#5929911272604125650
異食癖有一個API,你爲什麼刮? – 2013-10-02 01:13:37
上傳後我沒有獲取獲取照片url的文檔 – user2489961