Page 1 of 1

How do you run a command from PHP

Posted: Fri Dec 03, 2004 10:21 am
by irishmike2004
Hello:

How do you run a UNIX command (like CURL) from PHP? and can the result be put into a variable? Specifically I am wanting to get local weather data from weather.com and put the result into my page.

Thanks,

Posted: Fri Dec 03, 2004 10:47 am
by timvw
How do you read the documentation?

http://www.php.net/curl
http://www.php.net/exec

Posted: Fri Dec 03, 2004 10:53 am
by irishmike2004
yes but should you use exec() or shell_exec() if you just want to run it like a command line run? I was reading about exec and shell exec before I asked. The curl entry you mention looks complex.... I will post the actual command I am needing to run and perhaps then someone can tell me how to set it up. Additionally my PHP was compiled for Mac by a third party... Entrophy... I am not sure if he compiled support for Curl directly in or not.

Posted: Fri Dec 03, 2004 11:55 am
by irishmike2004
this one is solved. Thanks, documentation was all I needed after all, was not forming curl command properly