Page 1 of 1

cURL undefined function curl_init()

Posted: Sun Aug 18, 2002 2:16 am
by jamesm
Using phpinfo() I have half way down my list of features:

CURL support enabled
CURL Information libcurl 7.9 (OpenSSL 0.9.6b)

I run the script:

$ch=curl_init('https://www.anysite.asp');
;and go on set curl opts
$submit="some data";
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$submit);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$data=curl_exec($ch);
if (!data){
die(sprintf('Error [%d]: %s',curl_errno($ch),curl_error($ch)));
}


;and receive a fatal error in Zend development Environment of
Call to undefined function: curl_init() in <b>C:\Apache Group\Apache2\htdocs\myfile.php

In a browser this reads:

Notice: Use of undefined constant data - assumed 'data' in C:\Apache Group\Apache2\htdocs\myfile.php on line 28

It does actually perform the transfer, and I receive a stream of data back.

Am I being stupid (this is my first attempt at php) or is the curl entension not correctly installed. (or perhaps both)?
Thanks

Posted: Sun Aug 18, 2002 4:50 am
by aaronhall
Make sure the functions you are using are included in the CURL version you have installed?

-Aaron

Posted: Mon Aug 19, 2002 1:37 am
by jamesm
Thanks for the reply,

Yes its the latest version of cURL.

Any more ideas?

Posted: Mon Aug 19, 2002 6:46 am
by llimllib
Well, easier things first, the notice on line 28 comes because you should have if(!$data) instead of if(!data).
The curl_init error could be coming from Zend Studio not recognizing the curl extension, perhaps? try eliminating the $data error, then see if it works in a browser (or in the CLI, if that's what you're writing it for). If it does, but still doesn't work in Zend, then you've got to figure out how to enable curl support in zend.