How to post data using cURL

Discussion in 'PHP' started by KingCobra, Sep 6, 2011.

  1. #1
    dear friends,

    I want to post some data using php cURL to the following address. Note that the following target link is located another server.

    Target link:
    http://post.leadmesh.net/7de6d63386858895454af9c575b70cab53a1de72c1e008bd844a4ed5e5514ba5

    Data posting from:
    http://www.mysite.com/post.php (it just example)


    If you post data then the target page will show "fail" or "success".

    My requirement is that, after posting data to target link it will return to my server another page based on "fail" or "success" without displaying "fail" or "success". So normal visitors will not know where the data posted.

    Suppose my return linke will be:
    http://www.mysite.com/fail.php
    or
    http://www.mysite.com/success.php
     
    KingCobra, Sep 6, 2011 IP
  2. ssmm987

    ssmm987 Member

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    3
    Trophy Points:
    43
    #2
    Try:
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "id=string&id2=anotherstring");
     
    ssmm987, Sep 6, 2011 IP
  3. KingCobra

    KingCobra Well-Known Member

    Messages:
    289
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    Suppose I want to post following data:

    name
    age
    sex
    city
    state
    zip

    Please someone help me with full code. Because I have no idea about cUrl
     
    KingCobra, Sep 6, 2011 IP