arkadaşlar bir site var oradan veri çekmeye calışınca php curl çalışmıyor sebebi linkin yönlendirilmesi. kullandığım kod
<?php
$Url = "veriyi çekmek istediğim link";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE );
curl_setopt($ch, CURLOPT_HTTPHEADER, array(’Host: link host’));
curl_setopt($ch, CURLOPT_REFERER, "veriyi çekmek istediğim linkn sayfası" );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
$header = array(
’Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8’,
’Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7’,
’Accept-Language: en-us;q=0.8,en;q=0.6’ );
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$html = curl_exec($ch);
curl_close($ch);
$text = strip_tags($html);
preg_match_all("@m3u8(.*?)\\",@si ", $text, $output);
$parts = explode(’"’, $output[0][0]);
?>
<?php echo $parts[0]; ?>
Php Curl ile yönlenen sayfadan veri çekme
3
●2.061
- 26-12-2016, 13:45:03
- 26-12-2016, 18:23:06Site adresini verebilirsen daha güzel olur. Direk sitede test yapıla bilir.
- 26-12-2016, 19:22:29hocam pm gönderdim skype den anlatsam biraz karışıkuguryildirim adlı üyeden alıntı: mesajı görüntüle