Подскажите почему не пашет этот код? Функция preg_match почему-то не работает.
| Код | <?php
function get_web_page( $url ) { $uagent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";
$ch = curl_init( $url ); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_ENCODING, ""); curl_setopt($ch, CURLOPT_USERAGENT, $uagent); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies); curl_setopt($ch, CURLOPT_COOKIEFILE,$cookies);
$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; }
$result = get_web_page("http://id.rambler.ru/script/newuser.cgi"); $uiniq=preg_match('/name="uniq_id" value="(.*?)" \/>/', $result['content']); $path=preg_match('/img id="secimage" src="(.*?)" width="300"/', $result['content']);
print_r ($path); print_r ($uiniq);
?>
|
|