Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running PHP from shell to get remote file

Status
Not open for further replies.

noelking

Programmer
Jun 12, 2003
1
US
If anyone could please give me a little insight as to what to do here, i'd really appreciate it. I need to create a php script that gets a remote file from another server, searches through the file for a piece of information, and then takes that piece of information that it found and outputs it to another, local file. I need to be able to add this to a cron manager somehow though.. can you make a php script that runs from the shell rather than the browser? i'm totally lost in all aspects here, a real php newbie. any help would be greatly appreciated!

-Noel King
 
Yes, yes you can. There's a command line interpreter for PHP, though it sounds like you're in Linux, and I'm not sure how to invoke it there, so I'll let someone who does fill you in.

As far as accessing a remote file, is it accessible via a URL or a filesystem path? If so, you can just use the
file();
function to read it into an array, then do your stuff.

If not you'll need some trickery, but I'd bet you get one of those two methods.

G'luck.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top