Hi guys, A little help would be appreciated on the following matter. I am trying to work with a URL that gets redirected to another URL which is random. I would like to get that address and work with it. For example: $site = "http://example.com/"; this is my URL but when the page is loaded it is from an address "http://example.com/content/some/other/directory/" What I would like to do is get something like $new_site="http://example.com/content/some/other/directory/"; Any ideas?? Really appreciate your help. Thank You.
Use this to have random links. First, create a text file lamed "links.txt". In that, enter your links, one per line with the text "NEWLINKNEWLINK" between each link like so: http://google.com NEWLINKNEWLINK http://yahoo.com NEWLINKNEWLINK http://msn.com NEWLINKNEWLINK http://fart.com <?php if (file_exists("./links.txt")) { srand((double)microtime()*1000000); $array_ad = spliti("NEWLINKNEWLINK",join('',file("./links.txt"))); $link = $array_ad[rand(0,sizeof($array_ad)-1)]; } else { $link = 'SET STATIC LINK IN CASE THERE ARE NO LINKS.'; } ?> PHP:
I am not sure if this solves my problem. Anyway I am going to be more clear on what I am trying to do. I am trying to fetch information from the reference website($site="http://example.com/" which gets redirected to another URL within the same site(http://example.com/some/other/directory/". What I want to do is get that redirected URL saved as a variable and work with it instead of the initial one($site). Basically I am trying to fetch news using regexp statements. Any Ideas? Thanks.