Mai intai setam header pentru formatul UTF-8
$headers[] = 'Connection: Keep-Alive'; $headers[] = 'Content-type: application/x-www-form-urlencoded'; $headers[] = 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'; $headers[] = 'Accept-Charset: utf-8;'; $headers[] = 'Keep-Alive: 300';
dupa setarea aray-ului cu header-ele, acesta trebuie integrat in CURL
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL,'http://www.google.ro/search?&q='.urlencode($val['keywords'])); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFilenameLogin); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFilenameLogin); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt($ch, CURLOPT_HEADER,0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($ch, CURLOPT_FAILONERROR, 1); $data = curl_exec($ch); curl_close($ch);