Page 1 of 1

How To Send A GET Request to HTTP using PHP

Posted: Tue May 19, 2009 10:19 pm
by receiver
As title mentioned,

for example, I want to send a get request to a permanent link(etc http://www.google.com) using php, the outcome will become google.com?0=name?

form is not the proper step, as in i need to type in the name. How do i send a request to http using php?

Thanks.
Edit/Delete Message

Re: How To Send A GET Request to HTTP using PHP

Posted: Tue May 19, 2009 11:45 pm
by jaoudestudios
How do you want the result to be returned?
Use

Code: Select all

$page = file('www.google.com?a='.$a);

Re: How To Send A GET Request to HTTP using PHP

Posted: Wed May 20, 2009 3:35 am
by receiver
Thanks for the reply.
However,

1. curl_setopt($ch, CURLOPT_URL, "http://example.com?0=". $email ."")
2. curl_setopt($ch, CURLOPT_URL, "http://example.com?0=abc%2Bdatacenter@gmail.com")

it works on the second, however the first one is not working. I think is the +(%2B) sign. How can i solve it, so that the browser can interpret + as %2B?

Re: How To Send A GET Request to HTTP using PHP

Posted: Wed May 20, 2009 4:02 am
by onion2k
Get vars should be url encoded. Use urlencode()