Obama '08

               
   

Go Back   Mike Simonds > Salesforce > PHP Snippets

This is a discussion on PHP Snippet to Run scripts from another script within the PHP Snippets forums, part of the Salesforce category; This is another great snippet that I found that allows a developer

Reply
 
LinkBack Thread Tools Rate Thread
  #1  
Old 05-27-2008, 11:30 AM
Administrator
 
Join Date: May 2007
Posts: 246
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike
Smile PHP Snippet to Run scripts from another script

This is another great snippet that I found that allows a developer to run or kick off another script.

An example would go like this would be if you run script a.php and needed to kick off another script to process something else in the same script, you can use this function

Here's the snippet:

PHP Code:
echo @stripslashes(@join(@file("http://www.mysite.com/script_b.php"),"")); 
You can use it like this in script_a.php

PHP Code:
<?php
//Your code here to run your process
//queries, files, code, etc....
//once your process ends, kick off script_b.php
@stripslashes(@join(@file("http://www.mysite.com/script_b.php"),""));
?>
This has become really handy when I need to run and email reports to different groups within my company and run database extractions


Hope this helps someone

~Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2  
Old 05-28-2008, 01:02 AM
Junior Member
 
Join Date: May 2008
Posts: 7

Does this mean the 2nd script will run asynchronously? Or will the output of a.php be dependent upon b.php finishing?

Why not just use a function instead? Or just include b.php?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-28-2008, 07:48 AM
Administrator
 
Join Date: May 2007
Posts: 246
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike

If you have this at the end of script_a, it will run script_b, then script_a will finish.

Sure you could have a function or do a include or require, but there maybe circumstances.

The reason I run this like this is due to these scripts running database dumps from Oracle and then formatting reports to email to distribution lists and the main script that I am modifying is already large enough, too much code

So since I found this and it works, I just thought I would add it. You can do it anyway you want

~Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 05-28-2008, 07:50 AM
Administrator
 
Join Date: May 2007
Posts: 246
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike

Quote:
Originally Posted by hemmeter View Post
Does this mean the 2nd script will run asynchronously? Or will the output of a.php be dependent upon b.php finishing?
I was not sure if I answered your question. Script A is not dependent, in my case, upon Script B to finish. It is just another process that I needed to run

Hope that clears that up sir!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



Powered by vBulletin


SEO by vBSEO 3.2.0 RC8 ©2008, Crawlability, Inc.

1 2 3 4 5