473,800 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Code execution Time

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_ex ecution_time',9 99);
ini_set('max_in put_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_conte nts("http://$path");

if (!(is_numeric(s trpos($http_res ponse_header[0],"OK")))){ //
Is the website NOT ok
if (is_numeric(str pos($http_respo nse_header[0],"30"))){ //
Has it been redirected?
foreach ($http_response _header as $k=>$value){
$value = str_replace("Co ntent-Location","",$v alue); //
Strip out the Content tags which confuse issues
if (is_numeric(str pos($value,"Loc ation"))){ //
If this one carries the location - use it
$value = str_replace("Lo cation: ","",$value );
$http_response_ header = array();
$file2 = @file_get_conte nts($value); // Connect
to the forwarded site just to check
if (!(is_numeric(s trpos($http_res ponse_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>";
}
}
}
?>
Nov 29 '07 #1
4 1722
On Nov 29, 8:45 am, UKuser <spiderc...@yah oo.co.ukwrote:
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_ex ecution_time',9 99);
ini_set('max_in put_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_conte nts("http://$path");

if (!(is_numeric(s trpos($http_res ponse_header[0],"OK")))){ //
Is the website NOT ok
if (is_numeric(str pos($http_respo nse_header[0],"30"))){ //
Has it been redirected?
foreach ($http_response _header as $k=>$value){
$value = str_replace("Co ntent-Location","",$v alue); //
Strip out the Content tags which confuse issues
if (is_numeric(str pos($value,"Loc ation"))){ //
If this one carries the location - use it
$value = str_replace("Lo cation: ","",$value );
$http_response_ header = array();
$file2 = @file_get_conte nts($value); // Connect
to the forwarded site just to check
if (!(is_numeric(s trpos($http_res ponse_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.
Nov 29 '07 #2
UKuser 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_ex ecution_time',9 99);
ini_set('max_in put_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_conte nts("http://$path");

if (!(is_numeric(s trpos($http_res ponse_header[0],"OK")))){ //
Is the website NOT ok
if (is_numeric(str pos($http_respo nse_header[0],"30"))){ //
Has it been redirected?
foreach ($http_response _header as $k=>$value){
$value = str_replace("Co ntent-Location","",$v alue); //
Strip out the Content tags which confuse issues
if (is_numeric(str pos($value,"Loc ation"))){ //
If this one carries the location - use it
$value = str_replace("Lo cation: ","",$value );
$http_response_ header = array();
$file2 = @file_get_conte nts($value); // Connect
to the forwarded site just to check
if (!(is_numeric(s trpos($http_res ponse_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>";
}
}
}
?>
If you can change the PHP timeout parameter (some hosting companies let
you do so, some don't), you're probably running into a browser timeout.

If so, you might be able to keep the browser from timing out by calling
ob_flush() and flush() after printing a message. No guarantees - the
output may still be cached by your server. But then PHP isn't caching
it, also.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 29 '07 #3
On 29 Nov, 17:11, Jerry Stuckle <jstuck...@attg lobal.netwrote:
UKuser 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_ex ecution_time',9 99);
ini_set('max_in put_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_conte nts("http://$path");
if (!(is_numeric(s trpos($http_res ponse_header[0],"OK")))){ //
Is the website NOT ok
if (is_numeric(str pos($http_respo nse_header[0],"30"))){ //
Has it been redirected?
foreach ($http_response _header as $k=>$value){
$value = str_replace("Co ntent-Location","",$v alue); //
Strip out the Content tags which confuse issues
if (is_numeric(str pos($value,"Loc ation"))){ //
If this one carries the location - use it
$value = str_replace("Lo cation: ","",$value );
$http_response_ header = array();
$file2 = @file_get_conte nts($value); // Connect
to the forwarded site just to check
if (!(is_numeric(s trpos($http_res ponse_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>";
}
}
}
?>

If you can change the PHP timeout parameter (some hosting companies let
you do so, some don't), you're probably running into a browser timeout.

If so, you might be able to keep the browser from timing out by calling
ob_flush() and flush() after printing a message. No guarantees - the
output may still be cached by your server. But then PHP isn't caching
it, also.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Just wanted to say thanks guys for both your input. It is a mix of the
max-executiont time, the socket connection time and the browsers. I'm
nearly there - and get better results by running my script with php-
cgi.exe rather than through a browser.

Many thanks

A
Dec 5 '07 #4
Greetings, UKuser.
In reply to Your message dated Wednesday, December 5, 2007, 19:06:27,
and get better results by running my script with php-
cgi.exe rather than through a browser.
O.o What You mean "running script through a browser"?
--
Sincerely Yours, AnrDaemon <an*******@free mail.ru>

Dec 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2437
by: Johannes Lebek | last post by:
Hi there, lately, I experienced a strange thing on my DB2 V8.1 on Windows: Some queries took a very long time. A snapshot discovered the following: Number of executions = 47 Number of compilations = 1 Worst preparation time (ms) = 2 Best preparation time (ms) = 2 Internal rows deleted = 0
37
5996
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes in a separate file from the HTML. Apart from the obvious advantage if you have a separate designer and programmer, are there any other advantages to code behind? Most of the stuff I've seen so far uses code inside, but that's probably
3
47834
by: iam980 | last post by:
Hello All. We have tested following SQL script from query analyzer: -- Script begin DECLARE @I int; SET @I = 1; WHILE @I < 10000000 BEGIN SET @I = @I + 1; END -- Script end
88
8098
by: Peter Olcott | last post by:
Cab you write code directly in the Common Intermediate language? I need to optimize a critical real-time function.
3
2195
by: vashwath | last post by:
Hi all, I have written program for calculating the execution time of a function.Any critics (on the method of calculating execution time) are welcome. #include <stdio.h> #include <time.h> #include <limits.h> #define DENO 10
2
3740
by: Ina Schmitz | last post by:
Hi NG, does IBM Universal Database 8.2 make any difference between actual and estimated execution plans like in SQL Server ("set showplan_all on" for estimated execution plan and "set statistics profile on" for actual execution plan)? Does "explain plan selection for" generate the *estimated* execution plan? Didn't find any distinction of actual or estimated execution plans in the information center. Thanks for help,
8
3782
by: Magesh | last post by:
Consider a block, fncall( ); /* tells me the current millisecond or something like that: time-1 */ {/* block of code for which I need to know the exec time ... ... ... } fncall( ); /* tells me the current millisecond or something like that:
30
3550
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
6
4562
by: Mikhail Kovalev | last post by:
I'm using set_time_limit() to set maximum execution time. Is there a way to check how much time is left at any time during the execution itself?
4
27991
by: sphinney | last post by:
Hi everyone. I'm creating an application inside Access 2007. The application will retrieve data from various locations on my company's network servers. Depending on the time of day, alignment of the planets, other unfathomable mysteries sometimes my company's network is very, very slow. I would like to provide the user of my application with a "Cancel" button on a form that will cancel/stop execution of the code (at whatever point it may...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.