Welcome to WebmasterWorld Guest from 54.167.46.29

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

links issue

     
7:54 pm on Feb 22, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 13, 2009
posts:46
votes: 0


i am just getting a issue i am getting all the <a> tags from a remote page its give out like

../some.html
//example.com/some.html
or http://www.example.com/some.html

all the urls work if i can browse from the browser
but i need to correct them i need to make them all like example.com/some.html any idea ?

8:37 pm on Feb 22, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 13, 2009
posts:46
votes: 0


cant understand here more detail with example

array (
0 => "http//www.example.com/some/some.html",
2 => "www.example.com/some/some.html",
3 => "//example.com/some/some.html",
4 => "http://example.com/some/some.html",
5 => "some.html",)
);

all of this i want to output but same [WHATEVER.com...]

1:34 pm on Feb 23, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Apr 30, 2007
posts:1394
votes: 0


right you can deploy the filters you want for the various conditions. So in this example I assume you want to filter by the page html.

Assuming the $urls_array var holds the urls:

$urls_array = array (
0 => "http//www.example.com/some/some.html",
2 => "www.example.com/some/some.html",
3 => "//example.com/some/some.html",
4 => "http://example.com/some/some.html",
5 => "some.html",
);

echo '<pre>';
var_dump($urls_array);
echo '</pre>';

foreach($urls_array as $key => $value) {
$tmp_array = explode('/', $value);
if( is_array($tmp_array) && count($tmp_array) ) {
$urls_array[$key] = 'http://www.example.com/some/' . $tmp_array[count($tmp_array)-1];
}
}
echo '<pre>';
var_dump($urls_array);
echo '</pre>';

so the output should now show the urls with the domain and path included.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members