Sami Posted October 23, 2010 Share Posted October 23, 2010 How can I create a proxy?I've made one, but it sucks. Link to comment Share on other sites More sharing options...
boen_robot Posted October 24, 2010 Share Posted October 24, 2010 The HTTP extension, along with various content manipulation APIs, depending on what you want to use the proxy for. Link to comment Share on other sites More sharing options...
Sami Posted October 24, 2010 Author Share Posted October 24, 2010 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 More sharing options...
justsomeguy Posted October 24, 2010 Share Posted October 24, 2010 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 More sharing options...
boen_robot Posted October 24, 2010 Share Posted October 24, 2010 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 More sharing options...
Sami Posted October 28, 2010 Author Share Posted October 28, 2010 How do I use the HTTP extension? Link to comment Share on other sites More sharing options...
thescientist Posted October 28, 2010 Share Posted October 28, 2010 what have you tried? Did you look at the link boen_robot provided? or cURL? Link to comment Share on other sites More sharing options...
boen_robot Posted October 28, 2010 Share Posted October 28, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.