POST with cURL

This is a discussion on POST with cURL within the PHP General forums, part of the PHP Programming Forums category; These two scripts demonstrate a way of using POST to transmit data from one script to another. I do not ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-17-2004
rstuckart@stny.rr.com
 
Posts: n/a
Default POST with cURL

These two scripts demonstrate a way of using POST to transmit data
from one script to another. I do not see anything in the on-line
cURL documentation to indicate that this would cause any problems.

Have I overlooked anything?

<?php # script1.php
$urlstring = 'p1=data&p2=to&p3=script2';
$ch = curl_init("http://www.example.com/script2.php");
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $urlstring );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 0 );
$script2_response = curl_exec( $ch );
curl_close( $ch );
exit;
// This line is not executed.
echo $script2_response;
?>


<?php # script2.php
echo '<pre>script2.php - ';
print_r( $_POST );
echo '</pre>';
?>

TIA
Bob
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:42 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0