I have read some posts about this problem. Tried to use trim
but it does not help.
Php script sends a curl
request to another server which returns ok
if the request were successful.
$request = curl_send_function($uid, "suspend"); if ($request != 'ok') { echo $request; exit; }
The script shows ok
and stops to excecute – exits. Why ok
is not ok
for the script?
var_dump($request);
shows the following:
okstring(0) ""
Advertisement
Answer
Your “ok” isn’t saved in $request
but printed by your curl_send_function
. You need to set the cURL option CURLOPT_RETURNTRANSFER
.
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);