Jump to content

PHP proxy


Sami

Recommended Posts

Sometimes I am at places where some webpages aren't available.So I'm going to use it to access these webpages.What I've already have made, are giving me the page, but it looks different.It's not downloading pictures, css, flash etc...btw, how do I use "The HTTP extension"?

Link to comment
Share on other sites

Proxies generally rewrite links to point back to themselves, it doesn't matter if you use a proxy to just load the HTML if all of the links and images etc are still pointing to the blocked server. You may want to look into the cURL library, that can help with HTTP communication.

Link to comment
Share on other sites

Look at the linked documentation to see how it works. The basic idea is the same as XMLHttpRequest in JavaScript (a.k.a. AJAX) - for PHP to send an HTTP request internally, and receive the HTTP response. It's up to the PHP code itself to decide what request to send, and what it is going to do with the response.You can initiate a request with the HttpRequest class. Start with reading over its documentation.The mentioned cURL library is what the HTTP extension uses under the hood. If you're placing your proxy at a server where the HTTP extension isn't available, chances are the cURL extension will be. The only reason I'm reccomending you the HTTP one over cURL is because the HTTP extension has a lot more features and (IMHO) it's simpler to work with.Since we're not talking about a transparent proxy (one where your computer would automatically go to under certain network cirtumstances), you'll indeed need to manipulate all relative links to point to yourself. If the targeted site has valid (or at least well formed) (X)HTML, the easiest way is to use DOM, but if it isn't, you'll be force to revert back to regular expressions.

Link to comment
Share on other sites

:) How do I use the HTTP extension?
Look at the linked documentation
...Here's a key manual page, and with examples.(I've explained to you the basic workflow in my previous post)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...