I am using CURL to send a string and retrieve the response string.
Below is my code:
<? // check to see if the card is stolen.
// below is the data being passed to another server:
$data = 'number='.$number;
$ch = curl_init($trans_url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
// Execute the request.
$data_response = curl_exec($ch);
$succeeded = curl_errno($ch) == 0 ? true : false;
print $data_response;
// parse the $data_response string
$string = $data_response;
$string = str_replace("&","&",$string);
parse_str($string);
$res = $result;
echo $res;
?>
This is a simple curl script, and it works beautifully.
The part that says "echo $res; " actually returns with a SUCCESS response.
Now here's the really weird part! I added a simple IF statement after it:
echo $res;
if($res == 'SUCCESS'){ echo 'Text Here'; }
BUT! it does not return anything! I know the IF statement isn't wrong, because I tested it in different ways like:
$test = 'something';
if($test == 'something'){echo 'this should work'; }
Any thoughts on why nothing gets returned? Nothing is showing in the error logs either.
Help!!