nPhoenix

cURL [POST]

Feb 22nd, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. $url = "http://site.com/tal/form.php";
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
  4. curl_setopt($ch, CURLOPT_FAILONERROR, 1);
  5. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
  7. curl_setopt($ch, CURLOPT_TIMEOUT, 0); // times out after Ns
  8. curl_setopt($ch, CURLOPT_POST, 1); // set POST method
  9. curl_setopt($ch, CURLOPT_POSTFIELDS, "FREE_TEXT=php&op=1013&rel_code=1102"); // add POST fields
  10. curl_setopt($ch, CURLOPT_FAILONERROR, 0);
  11. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  12. curl_setopt($ch, CURLOPT_HEADER, 1);
  13. curl_setopt($ch, CURLOPT_COOKIEFILE, 1);
  14. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  15. $result = curl_exec($ch); // run the whole process
  16. curl_close($ch);
  17. echo $result;
Advertisement
Add Comment
Please, Sign In to add comment