Re: how to post a question?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux