note 83549 deleted from curl.examples by danbrown
| From: | danbrown@php.net | Date: | Sat, 07 Nov 2009 18:48:00 +0000 |
| Subject: | note 83549 deleted from curl.examples by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162496@lists.php.net to get a copy of this message | ||
Note Submitter: jlee8df at gmail dot com
----
Update to my previous code:
For every return statement, call "curl_close($ch);" or "fclose($fp);"
or both to pair up "curl_init()" and/or "fopen()".
For example:
<?php
// ...
// this statement:
// if( !curl_setopt($ch, CURLOPT_URL, $url) ) return "FAIL: curl_setopt(CURLOPT_URL)";
// should be:
if( !curl_setopt($ch, CURLOPT_URL, $url) )
{
fclose($fp); // to match fopen()
curl_close($ch); // to match curl_init()
return "FAIL: curl_setopt(CURLOPT_URL)";
}
// ...
?>
- JLèé