PHP curl fonksiyonu - PHP Webmaster bilgi bankası, knowledge base Webmaster Araçları

AnaSayfa > PHP > PHP curl fonksiyonu
Kategori: PHP
Gönderen: Admin
Tarih: 2009-08-08
Puan: 4   Puan:4 | Katılımcı:5 | Katılımcı : 5
Okunma: 5495
  
 
1 puan 2 puan 3 puan 4 puan 5 puan 6 puan 7 puan 8 puan 9 puan 10 puan

<?
function ch( $url, $post=false, $header=false )
{
$user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, $header ? true : false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, $post ? true : false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post ? $post : false);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_REFERER, $URL);
$icerik = curl_exec($ch);
curl_close($ch);
return $icerik;
}
?>



Yorumlar
Henüz Kimse Yorum Yapmamış, ilk yorumu siz ekleyin!
Yorum Ekleme Aparatı
Yorum Eklemek için lütfen sol menuden giris yapınız..
Toplam 0 yorum listelendi.