Help, I'm driving mad !!

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
chouchou
Forum Newbie
Posts: 1
Joined: Mon Jan 26, 2004 4:37 am

Help, I'm driving mad !!

Post by chouchou »

Ok. That's simple. Here it is

Code: Select all

<?php
  $result = shell_exec("wget -q -O - 'http://www.google.com'");
  echo $result;
?>
That's supposed to print on the standard output the source code of the web page http://www.google.com. Note I can't use fopen function because I'm behind a firewall.

Well the script works from the terminal, but it doesn't work with apache !! It doesn't display anything !!

Thanks for help !!
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

never knew firewalls didnt allow fopen :S and I don't see why
User avatar
Gonik
Forum Newbie
Posts: 19
Joined: Fri Aug 30, 2002 7:39 am
Location: Somewhere Around Nothing

Post by Gonik »

since this is a unix command try not to place the URL inside the single quotes. Also, as far as i remember, the -O parameter also requires a filename to output the file contents.

You can find many usefull information about wget @ http://www.gnu.org/software/wget/manual ... /wget.html
?>
User avatar
dimitris
Forum Contributor
Posts: 110
Joined: Wed Jan 14, 2004 3:47 am
Location: Athens, Greece

Post by dimitris »

Gonik wrote:since this is a unix command try not to place the URL inside the single quotes. Also, as far as i remember, the -O parameter also requires a filename to output the file contents.

You can find many usefull information about wget @ http://www.gnu.org/software/wget/manual ... /wget.html
?>
I agry with Gonik that you should output the results to another file then the syntax will be ok! :wink:
Post Reply