hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : creating a loop to require a file each 10 secs
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

creating a loop to require a file each 10 secs

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 08-16-2006, 06:18 AM
mikey1090 mikey1090 is offline
Web Hosting Evangelist
 
Join Date: Feb 2006
Location: Lancashire, UK
Posts: 472

creating a loop to require a file each 10 secs


Hi, i was wondering if someone could show me a php script - a loop of some sort that would be run by a cronjob each minute, and would include a php file, before sleep(10); (pausing for 10 secs)


Can anyone help me?

Reply With Quote


Sponsored Links
  #2  
Old 08-16-2006, 08:03 AM
Elliot A Elliot A is offline
Web Hosting Guru
 
Join Date: Oct 2004
Location: Brisbane, Australia
Posts: 256
Why do you need to require a file every 10 seconds? If you meant download then:

PHP Code:
<?php

while ( true 
{
    
file_get_contents FILEHERE );

    
sleep 10 );
}

?>

__________________
Elliot Anderson
PHP, Python and Ruby Developer


Reply With Quote
  #3  
Old 08-16-2006, 08:04 AM
bigfan bigfan is offline
WHT Addict
 
Join Date: Nov 2005
Posts: 123
PHP Code:
$num_1oops 10;
$inc_file 'included.file';
$sleep_time 10;
 
for (
$i 0$i $num_1oops$i++) {
    require 
$inc_file;
    
sleep($sleep_time);


Reply With Quote
Sponsored Links
  #4  
Old 08-16-2006, 08:10 AM
mikey1090 mikey1090 is offline
Web Hosting Evangelist
 
Join Date: Feb 2006
Location: Lancashire, UK
Posts: 472
thanks, but i was wondering about include_once, as when i previously tried require, it produced errors as functions in my config file were being required twice.

Reply With Quote
  #5  
Old 08-16-2006, 08:13 AM
bigfan bigfan is offline
WHT Addict
 
Join Date: Nov 2005
Posts: 123
Do you mean you want to include_once, every ten seconds? Wouldn't it have been easy to say that in your first post?

Reply With Quote
  #6  
Old 08-16-2006, 08:24 AM
mikey1090 mikey1090 is offline
Web Hosting Evangelist
 
Join Date: Feb 2006
Location: Lancashire, UK
Posts: 472
yeah sorry about that. i want it to run my php file each 10 seonds, for ever. i will run the loop file in a cronjob each minute

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
File Sharing Site Rapidshare Cuts 45 Jobs as Traffic Declines Web Hosting News 2013-05-17 16:03:15
Flux Launches Free Cloud Workflow Management Service for Web Hosts, Businesses Web Hosting News 2012-03-28 15:41:00
Cloud Firm ActiveState Adds to PaaS Market with Release of Stackato Platform Software Web Hosting News 2012-03-02 13:32:58
SingleOS Launches Fuscan Linux Cloud 2.0 Web Hosting News 2011-08-12 19:09:05
Web Host WebHostingBuzz Partners with Cloud Platform SMEStorage Web Hosting News 2011-06-01 18:10:25


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?