How To Send A GET Request to HTTP using PHP

Discussion in 'PHP' started by receiver, May 19, 2009.

  1. #1
    As title mentioned,

    for example, I want to send a get request to a permanent link(etc 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.
     
    receiver, May 19, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    Use can use cURL for that.
     
    Kaizoku, May 20, 2009 IP
  3. receiver

    receiver Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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?
     
    receiver, May 20, 2009 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    Kaizoku, May 20, 2009 IP
  5. g4coder

    g4coder Member

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #5
    use urlencode function like:
    curl_setopt($ch, CURLOPT_URL, "http://example.com?0=". urlencode($email))
     
    g4coder, May 20, 2009 IP