PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 22nd, 2000, 01:05 AM
ryanh ryanh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 1999
Posts: 119 ryanh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 41 sec
Reputation Power: 14
I want to retrieve the content of a web page similar to wget for UNIX or HTTP::Request for perl. Does anyone know how to do this?

Reply With Quote
  #2  
Old March 22nd, 2000, 09:43 AM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Central Florida, USA
Posts: 2,306 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 6 h 42 m 51 sec
Reputation Power: 60
1. Have you tried:

include('filename.html');

This should just include the contents of a file into your PHP script. This can cause problems if the file you're including has elements that PHP tries to parse--which you don't want parsed.

2. This script will pass any external file to the browser through your script.

<?php
$filename = "http://www.yoururl.com/";
$fd = fopen("http://www.yoururl.com/", "r");
fpassthru($fd);
?>

3. This script opens a file, turns the contents into a variable, with which you can do whatever you want, but it only works with local server files.

<?php
$filename = "/usr/home/yourdirectory/public_html/htmlfile.html";
$fd = fopen($filename,"r");
$contents = fread($fd,filesize($filename));
fclose($fd);
echo $contents;
?>

Also, you could use fopen() for a remote URL, and then fwrite() to save the file locally, and then do what you want with it with fread().

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > HTTP requests... retreiving a web page

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap