cURL: curl_exec return value
| From: | phphelp -- kbk | Date: | Sat, 20 Dec 2008 17:55:34 +0000 |
| Subject: | cURL: curl_exec return value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-284889@lists.php.net to get a copy of this message | ||
Hey - - - - ----- - -
I am new to using cURL, so I would appreciate your help. Fortunately, I have samples to follow, but the return value is not as I expect.
In short, instead of returning a Resource, it is just returning TRUE.
I have tried setting:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TRANSFERTEXT, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
I have tried these together and separately and in all combinations. (IOW: flailing blindly)
Any clue what I am doing wrong? (relevant code below)
Ken
Code:
-----------------------------------------------------
$url = $this->cc_submit_post_url;
$ch = curl_init();
// my lines, in any combination
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TRANSFERTEXT, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
// these lines are *supposedly* well-tested
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_HEADER, false); // providing a header manually
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
// The following two options are necessary to properly set up SSL
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
$data = curl_exec($ch);
if (curl_errno($ch)) {
$appl['error_message'] = curl_error($ch);
$return_val = FALSE;
} else {
curl_close($ch);
}
-------------------------------------------