lucavilla
asked on
shortest code to open a web page from PHP
I have Windows Vista and PHP with Curl.
I would save a web page on my harddisk with a PHP command-line command. What's the more minimalist way to do it?
I would save a web page on my harddisk with a PHP command-line command. What's the more minimalist way to do it?
ASKER
C:\Program Files\PHP>php -r 'file_put_contents("test1. txt", file_get_contents("h
ttp://www.pippo.com"));'
PHP Warning: Unexpected character in input: ''' (ASCII=39) state=1 in Command
line code on line 1
PHP Parse error: syntax error, unexpected $end in Command line code on line 1
C:\Program Files\PHP>php -r file_put_contents("test1.t xt", file_get_contents("ht
tp://www.pippo.com"));
PHP Parse error: syntax error, unexpected $end in Command line code on line 1
C:\Program Files\PHP>
________
What's the problem?
ttp://www.pippo.com"));'
PHP Warning: Unexpected character in input: ''' (ASCII=39) state=1 in Command
line code on line 1
PHP Parse error: syntax error, unexpected $end in Command line code on line 1
C:\Program Files\PHP>php -r file_put_contents("test1.t
tp://www.pippo.com"));
PHP Parse error: syntax error, unexpected $end in Command line code on line 1
C:\Program Files\PHP>
________
What's the problem?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it works. THANKSSSSSSSSSSSSSS A LOT!!!!
download.php
<?php
file_put_contents($_SERVER
Then call the script to download
php.exe download.php http://www.example.com destination.html
or without any saved script:
php.exe -r 'file_put_contents("destin