$ret_data = curl_exec ($ch); preg_match('/szIsApproved=(-*[0-9]*)/i', $ret_data, $arr); switch ($arr[1]) { case '1': then do everything i want; break; case '0': echo $error break; } The problem is that it only sometime works like this, which has been ripping my head apart and i need to support more...