Tuesday, 1 October 2013

How to Get Domain Url From Page

How to Get Domain Url From Page

i am trying to get exact domain url from html page
i trying this url only return from v.html
https://picasaweb.google.com/114948445121686813006/DropBox?authkey=Gv1sRgCMLjxpef1rHJ3QE#5929911272604125650
but my php function show all urls
v.html have html code and links
this is my php code
<?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 />';
}
?>
Output
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

No comments:

Post a Comment