Re: FGET nightmare (newbie)
| From: | Toby Butzon | Date: | Sat, 02 Dec 2000 16:12:47 +0000 |
| Subject: | Re: FGET nightmare (newbie) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28367@lists.php.net to get a copy of this message | ||
Try this:
<? /* program to display any URL given */
$fd = fopen($url, "r") or die("Unable to open location");
fpassthru($fd) or die("Unable to read file");
fclose($fd);
?>
Just give it a location by adding ?url=http://whatever.com/you/want to the
end of it.
It's the basic idea of what you were saying, but any relative links will be
broken, and you won't get any images if he's blocked your access to the
site. You could modify it to actually parse the HTML and download images,
stylesheets, and whatnot for you, but it'd be a bit more time consuming than
this was.
Good luck!
Toby Butzon
[ criticism spurs improvement ]
----- Original Message -----
From: "Alain "Cyb"" <alain.cyberspace@skynet.be>
To: "PHP List" <php-general@lists.php.net>
Sent: Saturday, December 02, 2000 6:08 AM
Subject: [PHP] FGET nightmare (newbie)
: Still in the proccess of learning PHP, as an exercise (My buddy here in
: charge of Security here, denied me access to the a particular Ubb during
: working hours, LOL ! So, basicaly, I want to POST something and send him
the
: link to it, hehehe )
:
: I figured I'd do this :
: From an external server (www.mycgiserver.com, the host runs PHP4) I am
: building a page that will
: read the data from that UBB' HMTL page (Example:
: http://www.thesiteiwant.com/ubb/Forum4/HTML/000966.html).
I want my page
: to parse the data than re-write it on another one (not on the blocked
: domain...).
: So, going from the tutorials, I gathered this much...
: /******************/
: /*enter URL via a form*/
: /******************/
: /* THEN */
:
: $filename = "http://www.thesiteiwant.com/ubb/Forum1/HTML/006570.html";
: $fd = fopen ($filename, "r");
: $contents = fread ($fd, filesize ($filename));
: echo $fd ;
: echo $contents;
: fclose ($fd);
: /******************************/
: /* End of Code */
: /*******************************/
: $contents should give me the Raw HTML code, or am I realy missing the
point
: again? <g>
: ------------------
:
: Al
:
:
:
: --
: PHP General Mailing List (http://www.php.net/)
: To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
: For additional commands, e-mail: php-general-help@lists.php.net
: To contact the list administrators, e-mail: php-list-admin@lists.php.net
:
: