download data from other sites
Moderator: General Moderators
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
download data from other sites
How can I download web pages with php? I want to download the web pages using php then display them. Anyone know how?
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
You can't ever view the PHP if PHP is installed correctly and the script is served by HTTP.psychotomus wrote:how can I see all?
Also, fopen() wont work all the time... some sites will reject you for not sending the User-Agent: header.
As I have found froma recent project, fsockopen() does the job much better and you can spoof the script as whatever browser you like....
Even better - use cURL
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
You still wont get the PHP code...psychotomus wrote:cant i connect to the site as if my php script was a browser and get all the contents then display it?
The PHP will have been parsed by the time it reaches your browser.
In terms of making the script look like a browser, cURL does it pretty well. Next inline, fsockopen() with the correct headers