How use cURL library when running PHP through Command Line

If you run any PHP code which using cURL extension through command line like this:

c:\>php somefile.php

it might give error that “curl_init()” function is not defined. The reason is the cURL extension “php_curl.dll” is not loaded. So, to resolve this issue you can load cURL (or any extension) dynamically in your PHP code. The “dl()” basically load PHP extension at runtime.

<?php
dl("php_curl.dll");
...
?>

,


  1. No comments yet.
(will not be published)

 


Submit Comment
Subscribe to comments feed
  1. No trackbacks yet.