tags:

views:

147

answers:

1

I have no clue how to use fsockopen. Could someone please post a small example of how to use fsockopen to post data to a website that is not mine, and then return the source code of the page with post data.

An example of what id like is lets say a website will multiply whatever the form with the name "output" says by 5. So if i post data to it with the output "2", the page should echo "10", and i would like to have a variable to get the file contents of when it says "10".

A: 

If you insist on doing this work with fsockopen, then you will open a connection to port 80 of the remote web server, use fwrite to send the HTTP protocol require data and fgets to read the response.

However, I think you will be well served to use cURL for this purpose.

Segfault