function datagel($url, $proxy)
{
$tarayici = $_SERVER['HTTP_USER_AGENT'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (preg_match('|https\:|isU', $url)) { curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false); }
if ($proxy) {
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
}
curl_setopt($ch, CURLOPT_USERAGENT, $tarayici);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 33);
$cekilenveriler = curl_exec($ch);
curl_close($ch);
return $cekilenveriler;
}
Bu oluşturdumğumuz fonksiyonu aşağı şekilde kullanabilirsin.
datagel('http://site.com/', 'proxyip:port');