Posts
Showing posts from August, 2014
curl error handling method
- Get link
- X
- Other Apps
The post data using curl php and curl error handling can be checked using the curl_errno() function in curl,which get error no of the exception occured while running the curl file.like I was working on an api in which i used following code i had error no of 28 which is know as request time out,so according to curl there several error no with detail. php curl examples php curl code: error_reporting(E_ALL); ini_set('display_errors', 1); try{ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'http://example.com'); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec($ch); $curlerrno = curl_errno($ch); curl_close($ch); print $curlerrno; var_dump($content); }catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } list of error number: $error_codes =array( [ 1 ] => 'CURLE_UNSUPPORTED_PRO...
TUBEZ - Radiation-Free Air tube Headset www.Smart-Safe.com
- Get link
- X
- Other Apps
php: nested if in select tag
- Get link
- X
- Other Apps
nested if needs to be grouped to avoid unexpected error: Ex: // //Parse error: parse error, unexpected ':' $slect='<option value="1" '.$val== "1" ? 'selected="selected"' :''.'>slect1</option>'; //Work: $slect='<option value="1" '.($val == "1" ? 'selected="selected"' :'').'>slect1</option>'; echo $var;