FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


cURL and cron





janszmatt
I have a list of web pages needed to be visited every 24h and i would like to use both cURL and cron jobs to do so.

The question is how do i write the code for cURL if the web pages are eg:

www.visitme.com
www.clickme.com
www.hitoyou.com
MrBlueSky
You can visit a homepage with cURL like this:

Code:

$ch = curl_init("http://www.visitme.com/");
curl_exec($ch);
curl_close($ch);


To visit a list of sites, put them in an array, like this:

Code:

$sites = array("www.visit.com", "www.clickme.com", "www.hitoyou.com");

foreach($sites as $site) {
  $ch = curl_init("http://".$site);
  curl_exec($ch);
  curl_close($ch);
}
Dougie1
And for automating the visiting do this:

Stubru Freak wrote:
Dougie1 wrote:
Well I would like a script to be loaded every couple of minutes. I have tried ignoring user abort and sleeping but this does not work as it seems to stop when the site goes down.

Is there any sites which can visit the page every few minutes? Or is there another way to do this? Thanks.


If you're on Frihost server 2, do this:
- Go to your Control Panel, log in, click Cronjobs.
- Fill in when you want to run the script. For command, fill in the following:
Code:
/usr/local/bin/php -f "/home/YOURUSERNAME/PATH/TO/SCRIPT.php"
manav
cURL is easy...... read the codes give in php.net for cURL and i've written some samle programs at phpian.com...do refer them too...
Aredon
I'd personally use curl_multi_add_handle now that frih.net supports PHP5.
Related topics
cron jobs
Using cron.
Cron
Cron Jobs and Php
Google Sitemaps and Cron
Cron Jobs
propos des cron jobs
Cron Folder Backup
Questions about cron jobs and permissions
Curl and OpenSSL
[RESOLVED] cron jobs
Cron Job to Backup MySQL Database
cron job
Cron jobs
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.