CURL Basics with Example
In the PHP installation libcurl provides the CURL functionality which enables the user to communicate with different types of servers with different types of protocols like : http, ftp, https, file in which http is widely used. It supports different http methods(GET,POST,PUT) while communicating or submitting information to the server. Abbreviation: Called as cURL ( Client URL or Client URL library) Enabling curl: There is a PHP curl dll extension defined in the php.ini configuration file ;extension=php_curl.dll Remove semi-colon before this and save-restart the server. Basics: curl_init - initializes the curl session eg: $request = curl_init (); // initiate curl object curl_setopt - sets the curl transfer options like http methods and values, header, ssl, encoding etc. Some options(OPT) are as follows:- curl_setopt ($request, CURLOPT_URL, $requestUrl); // sets the url to which curl has to communicate like : https://example.com/Portal/downloadfile.do , http...