cURL: curl_exec return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);
	}
-------------------------------------------

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux