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
cURL undefined function curl_init()
Moderator: General Moderators
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.
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.