I'm using cURL to POST form fields to a PHP script on a different server that does a database insertion. I know the POST is working, because the values are being inserted into the database. But I want to return results from the remote server so I can tell if the insert was *not* done.
Here's the relevant part of the sending script: $ch = curl_init(); $remote_url = "http://www.whatever.com/scriptname.php"; curl_setopt ($ch, CURLOPT_URL, $remote_url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $field_values); ob_start(); curl_exec ($ch); curl_close ($ch); $curl_results = ob_get_contents(); ob_end_clean(); // check cURL results if ((trim($curl_results) != 1) || (trim($curl_results) != 0)) { // maybe nothing returned, bail out echo("<p>Can't confirm results of attempt to add to database!</p>\n"); exit; } Here are the relevant parts of the receiving script: // return notice if connection fails if (!$db_connection) { echo 0; exit; } ... // return notice if database insert fails if (!$db_connection->execute($insert_sql)) { echo 0; exit; } else { echo 1; } The receiving script doesn't display anything and should only echo as shown above. I don't get how to return success or failure from the receiving script. The information I've been able to find on cURL doesn't clarify this. Can anyone shed some light? Thanks. -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php