Jump to content
bubbles

Functie CURL

Recommended Posts

Posted

Am urmatoarea functie php :

function curl_download($Url){
if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); }
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_REFERER, "http://www.blabla.com");
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}

Care este folosita pe EX: site.ro/curl.php unde merge perfect cand accesez acest fisier.

Am facut si un CRONJOB :

php /home/blabla/site.ro/curl.php >/dev/null

Insa uneori la CRONJOB da rateuri, nu-mi returneaza/afiseaza nimic aceasta functie, insa daca accesez site.ro/curl.php din browser merge tot timpul (rareori trebuie sa dau un CTRL+R).

Ce poate fi ?

Multumesc.

Posted
Am urmatoarea functie php :

function curl_download($Url){
if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); }
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_REFERER, "http://www.blabla.com");
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}

Care este folosita pe EX: site.ro/curl.php unde merge perfect cand accesez acest fisier.

Am facut si un CRONJOB :

php /home/blabla/site.ro/curl.php >/dev/null

Insa uneori la CRONJOB da rateuri, nu-mi returneaza/afiseaza nimic aceasta functie, insa daca accesez site.ro/curl.php din browser merge tot timpul (rareori trebuie sa dau un CTRL+R).

Ce poate fi ?

Multumesc.

Incearca sa faci cron-ul asa:

* * * * *  /usr/bin/curl --silent --show-error http://site.ro/curl.php &>/dev/null

Daca ceva nu e in regula, vei vedea si problema in error log.

Posted (edited)

Posibil sa fie ceva legat de caching? Zic si eu :-/

EDIT: Inca o chestie. Daca folosesti un shared host si mai ales unul gratis. Dupa un anumit numar de pagini incarcate de un client, serverul va trimite o pagina goala pentru o perioada scurta de timp. Depinde cat de frecvent este executat acel cron job.

Edited by S.L.C
Posted
Posibil sa fie ceva legat de caching? Zic si eu :-/

EDIT: Inca o chestie. Daca folosesti un shared host si mai ales unul gratis. Dupa un anumit numar da pagini incarcate de un client, serverul va trimite o pagina goala pentru o perioada scurta de timp. Depinde cat de frecvent este executat acel cron job.

Am Gazduire Web Business de la romarg.

Merci de link, am sa incerc.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...