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?