Results 1 to 2 of 2

Thread: PHP - curl & posting (and sending the user) to a page

  1. #1

    PHP - curl & posting (and sending the user) to a page

    Hi peoples,

    I'm trying to find some information on php and the curl library, but am not having much finding what I'm after.

    What I need a script to do is load up, grab some information in a database and post this information to a url, but actually follow the url, so if im posting var1 to the url msn.com, it would be as if I had a html form that posted to that url.

    Does anyone have any ideas? :/

    thanks!

  2. #2
    Something like this:

    <?

    $posting = curl_init( "http://the.url.of.the/receiving/script.asp" ); //can be obtained from the source code of the page with the form

    curl_setopt( $posting, CURLOPT_POST, true );
    curl_setopt( $posting, CURLOPT_POSTFIELDS, "field1=Value&field2=One%20more%20value&field3=123 45" ); // form data encoded the same way as a browser would encode it (it's called application/x-www-form-urlencoded)

    curl_exec( $posting ); // cURL sends data to the script and prints output

    curl_close( $posting );

    ?>

    Many more cURL options can be found at http://php.net/manual/en/function.curl-setopt.php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012