1

I have a server with a PHP script that pulls data from a source and populates a database. I need to call this PHP script repeatedly, each time with a different parameter.

I need to create a shell script on a Mac (which reads in a text file with the list of parameters - that part is not a problem) and for each parameter, runs the PHP script/URL in a web browser.

The PHP is on a remote server, so I need to load a web browser instance (safari or firefox) and instruct it to load the URL (ie. something like http:/myserver.com/scriptname.php?param1). Then I need to wait for it to complete and trigger the same URL with the next parameter.

I don't know the incantation to launch the web browser with a URL (I am a former Windows dev not a Mac OS-X pro, yet). I also don't think there is a way to detect when the script completes - but I don't want to end up with 100 instances of the browser running simultaneously.

Any help would be greatly appreciated!

2
  • Is there a reason this needs to be done in a web browser rather than with something like cURL or wget? Commented Jul 13, 2010 at 23:49
  • curl / wget seem more proper candidates indeed, although, as I see it, a local cronjob on said server could even be more effective.... Commented Jul 13, 2010 at 23:57

2 Answers 2

4

If you just need it to hit a php page on a remote server, don't use a browser. Use curl, or some equivalent.

curl http:/myserver.com/scriptname.php?param1

Sign up to request clarification or add additional context in comments.

1 Comment

Excellent - I didn't know you could do that! Works perfectly, exactly what I needed. THANK YOU!
0

open -a Safari http://stackoverflow.com

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.