note 50734 added to function.curl-exec
| From: | J�rgenTjern� at osu1 dot php dot net | Date: | Tue, 08 Mar 2005 14:12:17 +0000 |
| Subject: | note 50734 added to function.curl-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86105@lists.php.net to get a copy of this message | ||
If you've got problems with curl_exec not working, you should rather check curl_errno and
curl_error than using commandline curl, like so:
(since this is easier, and also allows you to check for errors runtime, which is a vital part of any
well-design piece of code. ;)
<?php
$creq = curl_init();
curl_setopt($creq, CURLOPT_URL, "http://www.foo.internal");
curl_exec($creq);
/* To quote curl_errno documentation:
Returns the error number for the last cURL operation on the resource ch, or 0 (zero) if no
error occurred. */
if (curl_errno($creq)) {
print curl_error($creq);
} else {
curl_close($creq);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.curl-exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50734
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50734&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50734&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50734&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50734&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50734&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50734&report=yes
Search -- http://master.php.net/manage/user-notes.php