Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dotty

macrumors member
Original poster
Mar 28, 2006
76
0
Code:
<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://www.amazon.com/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$data = curl_exec($ch);

$pat = "/(href.{3})([a-zA-Z0-9].+)('|\"+)/";
$rep = "href=\"http://www.amazon.com/$2\"";
      
$output = preg_replace($pat, $rep, $data);  

curl_close($ch);

echo $output;

?>

Any idea?

I want links which look like href='/dsfgdsfg/dsfgdsg/dsg and make them look like

href='http://www.amazon.com/dsfgdsfg/dsfgdsg/dsg

any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.