Forum Moderators: coopster
[mysite.com...]
/hello.php
mysite.com/test.php
etc.
How can I make all these urls absolute urls and put them back in an array?
If any one has any ideas they would be greatly appreciated.
Cheers
Chris
It's not quite working, it only appears to return the 1st letter of the 1st element in the array.
Am I doing something wrong, I know it collects the links fine, if I remove the 'while'part all the urls are echo'd:
$pattern = "/<a\s+.*?href=[\"\']?([^\"\' >]*)/i";
preg_match_all($pattern,$page,$matches);
while (list ($key, $value) = each ($matches)){
$matches[$key]="http://mydomain.com/".$value;
}
$num = count($matches[0]);
for ($x=0;$x<$num;$x++){
$results = $matches[1][$x];
echo $results.' <br>';
}
To me this make sense logically but doesn't work.
Any ideas?
Thanks again.
Chris