I have trouble sending data from remote server to a web server at hosting company. At remote server the cURL execute perfectly without any error, but in database at web server doesn't seem receive any data. I don't really know what or why this is happen. I've try to contact my hosting company for explanation and they said the server already support cURL lib. Can someone help me with this.
send.php (runs in remote server)
<?php
$number= '12345';
$status= 'SUCCESS';
$msg = 'Transaction is Success!';
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, 'http://mywebsite.org/update.php');
curl_setopt($curlHandle, CURLOPT_POST, 1);
curl_setopt($curlHandle, CURLOPT_HEADER, 0);
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, 'number='.$number.'&status='.$status.'&msg ='.$msg);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
if (!curl_exec($curlHandle)) {
echo 'An error has occurred: ' . curl_error($curlHandle);
}
else {
echo 'everything was successful';
}
curl_close($curlHandle);
?>
update.php (runs in web server)
<?php
include ("db_con.php");
$number = $_POST['number'];
$status = $_POST['status'];
$msg = $_POST['msg '];
$query = "UPDATE tbstatus SET status = '$status', msg = '$msg ' WHERE number = '$number '";
mysql_query($query);
?>
Thank you in advance.
echo curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);and the return is 301.HTTP/1.1 301 Moved Permanently Date: Wed, 23 Apr 2014 05:32:50 GMT Server: Apache Location: http://www.mywebsite.org/update.php Content-Length: 247 Content-Type: text/html; charset=iso-8859-1.