run php script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ilavos
Forum Newbie
Posts: 10
Joined: Tue Apr 18, 2006 4:01 pm

run php script

Post by ilavos »

I'm trying to run php scripts from within php scripts.Its a series of scripts that launch each other once they complete execution.But since they're in a loop,my browser stops execution saying it'll loop non stop.I use header() to do this.Is there a way to make my browser keep executing no matter what?
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

would include() work?
ilavos
Forum Newbie
Posts: 10
Joined: Tue Apr 18, 2006 4:01 pm

Post by ilavos »

I'm not sure if include() could actually execute the script.I use it for functions,but i'm not aware of how it could be implemented to actually run the scrip.
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

You can use fopen:

Code: Select all

<?php
$handle = fopen("http://myhost.com/myfile.php", "r");
$content = "";
while(!feof($handle))
{
  $content = fread($handle, 4096);
}
fclose($handle);
echo $content; //The result of "myfile.php" execution
?>
You also can send to "myfile.php" arguments, "myfile.php?id=1".
ilavos
Forum Newbie
Posts: 10
Joined: Tue Apr 18, 2006 4:01 pm

Post by ilavos »

Thanks i'll try that.I'll let u know how it works.
Post Reply