Page 1 of 1

how to rplace file_get_contents with curl

Posted: Fri Jun 25, 2010 10:15 am
by Jonathan_Allen
here's the parcer

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); ?> 
So, tell me please how to replace file_get_contents with curl

Re: how to rplace file_get_contents with curl

Posted: Fri Jun 25, 2010 12:57 pm
by Jonah Bron
The third result looks good.

http://lmgtfy.com/?q=php+curl