how to send data to a HTTP web server using libcurl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sharanraman
    New Member
    • Aug 2007
    • 1

    how to send data to a HTTP web server using libcurl

    how to send data to a HTTP web server using libcurl
  • gregerly
    Recognized Expert New Member
    • Sep 2006
    • 192

    #2
    Using PHP:

    [PHP]$url_to_send_da ta_to = "http://www.someurl.com/somepage.php";
    $ch = curl_init($url_ to_send_data_to ); [/PHP]

    You can then set options like this - there are more options than this, so do some research on how you want to set your options:

    [PHP]curl_setopt($ch , CURLOPT_HEADER, 0);
    curl_setopt($ch , CURLOPT_RETURNT RANSFER, 1);
    curl_setopt($ch , CURLOPT_POSTFIE LDS,$fields);[/PHP]

    Then you send the requst:

    [PHP]$resp = curl_exec($ch);
    curl_close ($ch);[/PHP]

    The variable $resp above holds the response from the server.

    Hope that helps.

    Greg

    Comment

    Working...