Welcome to WebmasterWorld Guest from 54.204.165.156

Forum Moderators: coopster & jatar k

links issue

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

5+ Year Member



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)

5+ Year Member



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)

WebmasterWorld Senior Member 5+ Year Member



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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month