Jump to content

Recommended Posts

Hello, I'm just starting to learn PHP, and I have a few questions.

 

First is if PHP's HttpRequest::send function uses the client's browser or the server it's being hosted on. My objective is to create a sort of proxy system, where I would submit parameters to my site, as in: www.MySite.com/relay.php?param1=X&param2=X. I need the relay.php to send all those parameters over to www.BlockedSite.com/para1=X&param2=X . Since the final destination is blocked by web filters, I need the server to send that request, not my browser. And that site also returns messages, and I need to display them. So I'm wondering if HttpRequest::send is executed client side, or server side. And in this case, I'll be using the GET method.

 

Second question is how I can simulate cookies data in the HttpRequest::send function. Certain cookie data is stored, and the site will request that in order to authenticate, but I can extract the data from the cookies and supply it to my relay.php. I will be using the POST method in this second example.

 

Third question is repeating the HTTP request a certain number of times (POST method). Is it possible to do this without user input? For example, a php script will start either with a timer or a user input, and then be able to repeatedly send and process HTTP requests after the user has closed their browser.

 

Thanks in advance for any clarifications you can provide. As I stated, I'm just starting to learn PHP, and I'm not sure if my objectives can be completed using this language. I'm used to Javascript and C/C++, and those are obviously impossible to use to try to do stuff like this.

Link to comment
https://forums.phpfreaks.com/topic/214444-clarification-needed/
Share on other sites

HttpRequest::send function uses the client's browser or the server it's being hosted on

 

HTTPRequest does not use the client's browser nor the server's. It uses the HTTP protocol to send it's message.

 

Since the final destination is blocked by web filters

 

Whose web filters? your companies? your schools? Downloading from Rapidshare are we? :P You realize that when caught with illegal material in a company/school you will have to call your lawyer?!

 

Anyway, you don't need HTTPRequest. A simpe file_get_contens() will do to relay everything to the blocked site.

 

echo file_get_contents('http://www.blockedsite.com/script.php?' . http_build_query($_GET));

Great! I'm not looking to download off of rapidshare, more of to send parameters to a remote server that's been blocked by a range set of IPs. The server is supposedly hosted in the same IP range as a company based in Alabania that spams internet forums and such, and everything in that range is blocked by the company. In order to prove that the remote server I'm sending commands to is harmless, I have to go through about a few light-years of red tape. I'm not even requesting data to be transfered, just passing a few commands to the server and getting a true/false return to see if the functions executed correctly.

 

Now, another question, any way to use javascript to parse and process the results returned by file_get_contents() ? I'm trying to make PHP work with javascript, I have a feeling I'm digging myself into a very deep pit right now...

 

Thanks for the help :)

I can't edit my last post, but I got another question. When I run the .php file on my server, I don't get to see any errors that occured. Is there some sort of way I can run the .php file on my computer (Windows 7 x64) and be able to simulate it running on my server? I googled this and found a site "windows.php.net", but I'm not sure if those download are what I'm looking for.

 

And should I download the Non Thread Safe or Thread Safe versions of PHP?

Thanks! Now, a more complicated question. I've managed to get HttpRequest working for POST methods now, but I face a major problem of simulating cookies data stored on my computer. I can manually extract the data, but I can't seem to be able to find a way to simulate that in my HttpRequest function. Google is no help this time, unfortunately.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.