i wanna using curl in php script and run it in command line mode.
here is the script
<?php
//enable_dl("php_curl.dll");
$ch = curl_init();
$options=array(
CURLOPT_URL=>"http://test.com/wp-content/themes/bluefocus/images/desc_img.jpg",
CURLOPT_BINARYTRANSFER=>true,
CURLOPT_VERBOSE=>true
);
curl_setopt_array($ch,$options);
$data = curl_exec($ch);
$fp=fopen("test.jpg","w");
fwrite($fp,$data);
curl_close($ch);
?>
i run it in cmd with command php get.php
the error message:
D:\project>php get.php
Fatal error: Call to undefined function curl_init() in D:\project\gals_curl_batch_download\get.php on line 3
phpinfo() in the webpage output shows curl has been enabled
cURL support enabled
cURL Information libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3
and here is the strange thing phpinfo() int the webpage output show, infact extension enabled in php.ini can be run in web page. the exact directory of the extension is under ./ext
extension_dir ./ext ./ext
but php -i | find "extension_dir" always show this and can't be modified with in php.ini file
extension_dir => C:\php5 => C:\php5
restarted apache serveral times, keeps the same error. so I wonder why the value of extension_dir can't be modified.
thx in advance.