note 111724 added to function.curl-exec
| From: | Anonymous | Date: | Thu, 21 Mar 2013 08:42:03 +0000 |
| Subject: | note 111724 added to function.curl-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194154@lists.php.net to get a copy of this message | ||
if you are doing a negative test against curl_exec and other variables and you need to use the
returned result to save to file or display, you have to place the curl_exec test inside brackets,
for example:
<?php
if( (!$result = curl_exec( $c )) || curl_error( $c) ){
trigger_error( curl_error( $c ) );
}
# now you can use $result to write the returned contents to a file with for example fopen()
?>
if you don't include the curl_exec in brackets it will only return a resource value. i
don't know if this is normal behavior or a bug as it does not occur when it is a positive test.
----
Server IP: 69.147.83.199
Probable Submitter: 113.10.31.110
----
Manual Page -- http://php.net/manual/en/function.curl-exec.php
Edit -- https://master.php.net/note/edit/111724
Del: integrated -- https://master.php.net/note/delete/111724/integrated
Del: useless -- https://master.php.net/note/delete/111724/useless
Del: bad code -- https://master.php.net/note/delete/111724/bad+code
Del: spam -- https://master.php.net/note/delete/111724/spam
Del: non-english -- https://master.php.net/note/delete/111724/non-english
Del: in docs -- https://master.php.net/note/delete/111724/in+docs
Del: other reasons-- https://master.php.net/note/delete/111724
Reject -- https://master.php.net/note/reject/111724
Search -- https://master.php.net/manage/user-notes.php