<?php
function curl_ini(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR,realpath(".").'/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE,realpath(".").'/cookies.txt');
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1) Gecko/20061010 Firefox/2.0;MEGAUPLOAD 1.0");
curl_setopt($ch,CURLOPT_VERBOSE,1);
return $ch;}
// загрузка с помощью курла
function get_file_by_curl($url){
$ch=curl_ini();
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec ($ch);
return $result;}
$word=' привет ';
$url='http://www.google.com/search?client=opera&rls=ru&rls=ru&q='.urlencode(iconv("windows-1251","utf-8",$word)).'&sourceid=opera&ie=utf-8&oe=utf-8';
echo get_file_by_curl($url);
?>