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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |