You are here: Re: Code execution Time « PHP Programming Language « IT news, forums, messages
Re: Code execution Time

Posted by ninja on 11/29/07 17:07

On Nov 29, 8:45 am, UKuser <spiderc...@yahoo.co.uk> wrote:
> Hi,
>
> I have the following script which I'm using to verify that websites
> exist. However in either FF or IE it only runs for about 60 seconds.
> I've changed what ini settings I think affect it, but to no avail. Can
> you tell me how to make it run for longer. I could have quite a few
> hundred sites and I simply want to make sure they return OK.
>
> The code will work as is but you'll see it probably won't do quite a
> long list. (stops at about 10).
>
> Thanks
>
> A
>
> <?php
> ini_set('max_execution_time',999);
> ini_set('max_input_time',999);
>
> if (!(isset($_POST['sites']))){
> print "<form method=\"post\" action=\"test2.php\"><textarea name=
> \"sites\" rows=25 cols=25></textarea><input type=\"submit\"></form>";
>
> } else {
>
> $sites = split("\r\n",$_POST['sites']);
>
> foreach ($sites as $path){
>
> $http_response_header = array(); // clear arrays in case previous
> data still held
> $file = array();
> $file = @file_get_contents("http://$path");
>
> if (!(is_numeric(strpos($http_response_header[0],"OK")))){ //
> Is the website NOT ok
> if (is_numeric(strpos($http_response_header[0],"30"))){ //
> Has it been redirected?
> foreach ($http_response_header as $k=>$value){
> $value = str_replace("Content-Location","",$value); //
> Strip out the Content tags which confuse issues
> if (is_numeric(strpos($value,"Location"))){ //
> If this one carries the location - use it
> $value = str_replace("Location: ","",$value);
> $http_response_header = array();
> $file2 = @file_get_contents($value); // Connect
> to the forwarded site just to check
> if (!(is_numeric(strpos($http_response_header[0],"OK"))))
> {
> print "$path <b>IS NOW</b> $value<br>";
> } else {
> print "$value redirected but is DEAD<br>";
> }
> }
> }
> } else {
> print "$path is not live<br>";
> }
> } else {
> print "$path is ok<br>";
> }
> }}
>
> ?>

Hey there UKUser, Have you considered using the command line binary
with lib_curl, then piping your output to an html file? I've done that
with MANY of my automated PHP scripts, with great success and no
concerns about timeouts. I've a script that can run as long as 2 hours
doing some data administration tasks from 1AM-3AM local, scheduled
through cron. Some of the data tasks required involve reading CSV
feeds from servers other than my own, as well as remote PostgreSQL
queries. There is another script that builds an HTML report on server
status and uptimes that's in a FF window with a META refresh tag that
triggers on 5 minute marks. Hope that gives you some ideas on how to
get your script doing what you need it to do.

Good Luck.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация