Mini Fetch Code

Mini fetch Code

< ?
$theLocation=”http://www.wired.com/”;

preg_match(”/^(https?://)?([^/]*)(.*)/i”, “$theLocation”, $matches);

$theDomain = “http://” . $matches[2];

$page = $matches[3];

$fd = fopen($theDomain.$page, “rb”);

$value = “”;

while(!feof($fd)){
$value .= fread($fd, 4096);
}

fclose($fd);

$start = strpos($value, ““);

$finish = strpos($value, ““);

$length = $finish - $start;

$value = substr($value, $start, $length);

$FinalOutput = preg_replace(”/(href=”?)(/[^”/]+)/”, “1″ . $theDomain . “2″, $value);

echo $FinalOutput;

flush ();

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • Live
  • StumbleUpon

2 Comments | Leave a comment »

  1. 1. Yuppie | February 23rd 2005 @ 10:11 pm

    What does this code do ?

  2. 2. Jake | May 11th 2008 @ 6:09 pm

    @Yuppie

    Looks like it extracts code from another site

Leave a Reply

required

required, hidden

one.com
smx

Start with £50 credit in your new Yahoo! Search Marketing account for a limited period only.

+ Advertise Here