Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

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