Answer the question
In order to leave comments, you need to log in
How to implement recursive launch of PHP on hosting?
There is a hosting where max_execution_time = 30, exec and system are disabled. It is necessary to parse about 200-300 pages, while the script must be called by cron after a certain time. I decided to do it through recursion, something like
$var1 = $_GET["var1"];
...
curl_setopt($ch, CURLOPT_URL,"http://domain.com/myphp.php?var1="....);
curl_exec($ch);
Answer the question
In order to leave comments, you need to log in
It will be much easier to change hosting or buy VDS, which is the most popular now. Otherwise, after solving the problem with 30 seconds, you will begin to "shake" for the load.
I offer my services in England: UAPEER Hosting Solutions
Did it once through sockets that call the script itself
public function exec_script($url, $params = array()){
$parts = parse_url($url);
if (!$fp = fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : 80))
{
return false;
}
$data = http_build_query($params, '', '&');
fwrite($fp, "POST " . (!empty($parts['path']) ? $parts['path'] : '/') . " HTTP/1.1\r\n");
fwrite($fp, "Host: " . $parts['host'] . "\r\n");
fwrite($fp, "Content-Type: application/x-www-form-urlencoded\r\n");
fwrite($fp, "Content-Length: " . strlen($data) . "\r\n");
fwrite($fp, "Connection: Close\r\n\r\n");
fwrite($fp, $data);
fclose($fp);
return true;
}
//теперь нам надо чекнуть ссылку на наличие в базе
$b=$this->checkBase($hash);
//если в базе такой страницы не существует
if($b==false){
$this->exec_script($addcache_url, array('hash'=>$hash, 'href'=>$href, 'parent'=>$content["id"]));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question