Re: how to post a question?
| From: | Ryan A | Date: | Fri, 22 Jul 2005 17:11:47 +0000 |
| Subject: | Re: how to post a question? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-219232@lists.php.net to get a copy of this message | ||
Hey,
Some more _dirty code_ as posted on http://php-php.com/a2ztips/test.php,
<?php
$filename =
file_get_contents('http://www.dtcc.com/ThoughtLeadership/menu.htm');
$o=array("../dtcc.css","images/","/http","..http:");
$n=array("http://www.dtcc.com/dtcc.css","http://www.dtcc.com/ThoughtLeadersh
ip/images/","http","http:");
$filename = str_replace($o, $n, $filename);
$old =
array("http://www.dtcc.com/ThoughtLeadership/images/dtcc_banner_logo.gif",
"http://www.dtcc.com/ThoughtLeadership/images/dtcc_banner_top_middle.jpg",
"http://www.dtcc.com/ThoughtLeadership/images/banner_topright.jpg","http://w
ww.dtcc.com/ThoughtLeadership/images/thoughtmenu_r2_c3.jpg","http://www.dtcc
.com/ThoughtLeadership/images/searcharrow.gif");
$new = array("http://www.dtcc.com/images/dtcc_banner_logo.gif",
"http://www.dtcc.com/images/dtcc_banner_top_middle.jpg",
"http://www.dtcc.com/images/banner_topright.jpg","http://www.dtcc.com/images
/thoughtmenu_r2_c3.jpg","http://www.dtcc.com/images/searcharrow.gif");
$filename = str_replace($old, $new, $filename);
echo $filename;
echo "done";
?>
You would still have to replace the links to the full path instead of the
relative path that it now has.
The str_replace calls are kinda expensive IMHO, a good regex would be better
(like I said in my last mail)
another thing to note is sometimes the remote server times out or is too
slow so the script times out...
I hope this helped dude...will take down the page from there in a few hours.
Cheers,
Ryan