how to rplace file_get_contents with curl
Posted: Fri Jun 25, 2010 10:15 am
here's the parcer
So, tell me please how to replace file_get_contents with curl
Code: Select all
<?php
$url = "http://site.com";
$unique_start = "<tr><td><noindex>";
$unique_end = "</a></td>";
function weather($url, $unique_start, $unique_end) {
$code = file_get_contents($url);
preg_match_all('/'.preg_quote($unique_start,'/').'(.*)'.preg_quote($unique_end, '/').'/Us', $code, $match);
return implode("<br>", $match[1]);
if (preg_match_all('/'.preg_quote($unique_start,'/').'(.*)'.preg_quote($unique_end, '/').'/Us', $code, $match))
print_r($match);
else
echo 'sry I cant find a thing';
}
echo weather($url, $unique_start, $unique_end); ?>