cURL is a library which allows you to connect and communicate to many different types of servers with many different types of protocols. Using cURL you can:
- Implement payment gateways’ payment notification scripts.
- Download and upload files from remote servers.
- Login to other websites and access members only sections.
PHP cURL library is definitely the odd man out. Unlike other PHP libraries where a whole plethora of functions is made available, PHP cURL wraps up major parts of its functionality in just four functions.
A typical PHP cURL usage follows the following sequence of steps.
curl_init – Initializes the session and returns a cURL handle which can be passed to other cURL functions.
curl_opt – This is the main work horse of cURL library. This function is called multiple times and specifies what we want the cURL library to do.
curl_exec – Executes a cURL session.
curl_close – Closes the current cURL session.
Right now some situations (parse errors, undefined function call, no more memory) in PHP result in fatal error – which means the engine can not continue with the request beyond this point. From the user point of view, this often results in a blank page. I wonder if it would be possible to have standard recovery mechanism that would allow the PHP engine on fatal error to enter some kind of “recovery mode” when it would output some very basic page saying “ok, I have some problems here, but don’t panic and just tell my programmer to fix the code”. It won’t give much info probably but it would allow production sites display nice message to the users instead of the boring snowfield panorama it displays now (that is if the administrator was smart enough to set display_errors to off). Continue reading
Few days ago when I was working on unseenapps, I came across a functionality which must be executed repeatedly after a certain interval of time. I thought of it and later find out the simplest way.
It was the cpanels in-built functionality called cron jobs.
So what a cron job is?
Well, a cron job is a cpanel module that allows you to run a certain command at times set by the jobs.
For example, you could set a cron job to delete temporary files every week so that your disk space is not being used by those files.
How to setup a cron jobs?
Basically you will want to run a PHP script file in specific intervals. Suppose you want to execute a php file called cronjob.php every one hour. This is what you do:
The CRON Command is in the Following Format
[ Minute – Hour – Day – Month – Weekday ] – Command Continue reading