• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP Question...

TheSpaceDude

New Member
Hello,

I am in the process of making a small proxy server. When I request a page from a remote server, I put the response in the var $data. How would I change all links in $data to this format:

http://www.mydomain.com/proxy.php?url=[LINK HERE]

and also add the host name and directory to the link if it's not already there (eg. change /index.php or filename.php to http://www.domain.com/filename.php)?

Thanks in advance,
 
Use str_replace and similar functions. Search for http:// and href= in the code. Can't be too hard..

http://php.net/manual

Jome
 
I've tried that, I can add the "/proxy.php?url=" to the links, but I cant get it to add the host name to the link if it is not already there. Any ideas on how I could do this? Anyone? :rolleyes:
 
Back
Top