
| The Following User Says Thank You to magnuslu For This Useful Post: | ||
| The Following User Says Thank You to magnuslu For This Useful Post: | ||
<?php
$url = 'http://www.aragon.ws/soccerdb/getmatches.php?id=714';
function get_web_page( $url ) {
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle compressed
CURLOPT_USERAGENT => "spider", // who am i
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
);
$ch = curl_init( $url );
curl_setopt_array( $ch, $options );
$content = curl_exec( $ch );
$err = curl_errno( $ch );
$errmsg = curl_error( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );
$header['errno'] = $err;
$header['errmsg'] = $errmsg;
$header['content'] = $content;
return $header;
}
$rawdata = get_web_page($url);
$content = $rawdata['content'];
$content = str_replace("document.write('", '', $content);
$content = str_replace("');", '', $content);
$content = str_replace(chr(10), '', $content);
$content = str_replace(chr(13), '', $content);
$content = str_replace('</td>', '|', $content);
$content = str_replace('</tr>', '#', $content);
$content = str_replace(' ','',$content);
$content = strip_tags($content);
$rows =explode('#',$content);
$result = Array();
foreach ($rows as $row) {
$columns = explode('|',$row);
if (count($columns) == 2) {
echo 'date:' . trim($columns[0]) .chr(13).chr(10);
}
if (count($columns) == 7) {
echo trim($columns[0]) . '|' . trim($columns[2]) . '|' . trim($columns[3]) . '|' . trim($columns[5]) .chr(13).chr(10);
}
}
?>
| The Following 4 Users Say Thank You to robbie For This Useful Post: | ||