Get Data From Another Website Using Php Curl

Get Data From Another Website Using Php Curl

Hello friends;

We will learn How to Get Data From Another Website Using Php Curl in this article.

We will get a list of movies on mynet in the following example.

<?php
$curl = curl_init(); // starting curl process
curl_setopt($curl,CURLOPT_URL,"http://sinema.mynet.com/vizyondaki-filmler"); // define link
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); // starting data transfer
curl_setopt($curl,CURLOPT_FOLLOWLOCATION,1); // following link
$sonuc = curl_exec($curl); // and assing to result
preg_match_all('@<div class="vizyonImg">(.*?)</div>@si',$sonuc,$new); /* only select the part we want with preg_match_all. finally we are looping and printing */
preg_match_all('@<ul class="vizyonInfo clr">(.*?)</ul>@si',$sonuc,$info);
$new = $new[0];
$info = $info[0];
echo '<ul>';
for($i=0; $i < count($info);$i++){
echo '<li>';
echo $new[$i].'<br>';
echo $info[$i];
echo '</li>';
}
echo '</ul>';
?>

That's it. Get Data From Another Website Using Php Curl actually very simple and easy.

If you have any questions, you can ask in the comments section.

I hope it has been helpful.

Hafzullah Yıldırım

Merhaba ben Hafzullah! Voiser.net, Hesaplus.com projelerinin kurucusuyum. 2015'te Kocaeli Üniversitesi'nden mezun oldum ve devamında Yüksek Lisans eğitimimi tamamladım. 2017'de çalıştığım şirketten istifa ederek kendi yazılım firmam Hafzullah.com.tr'yi kurdum.

İlk Yorumu Sen Yap

Benzer Yazılar

Voiser Kimin?
Voiser.net Nedir?
Voiser Yeni Ofisine Geçti
İzmit'te Pandemi (Tam Kapanma)
Kişisel Blog Para Kazandırır Mı
Bedelli Askerliğin Tarihçesi