demo: https://www.yahyaozinanir.com.tr/secim/index.php
<?php $site = file_get_contents("https://www.sabah.com.tr/secim/14-mayis-2023-genel-secim-sonuclari"); preg_match_all('@<div class="vote-result-text">(.*?)</div>@si', $site, $sutun); $sonuclar = []; foreach ($sutun[1] as $for) { preg_match_all('/<a.*?>(.*?)<\/a>/', $for, $basliklar); preg_match_all('/<strong>(.*?)<\/strong>/', $for, $anahtarlar); preg_match_all('/<span>(.*?)<\/span>/', $for, $degerler); $sonuc = []; foreach ($basliklar[1] as $index => $baslik) { $anahtar = trim(strip_tags($baslik)); $deger = trim(strip_tags($anahtarlar[1][$index])); $sonuc[$anahtar] = $deger; } $sonuclar[] = $sonuc; } $ataIttifakiyuzde = $sonuclar[3]['ATA İTTİFAKI']; $MilletIttifakiyuzde = $sonuclar[2]['MİLLET İTTİFAKI']; $CUMHUR = $sonuclar[0]['CUMHUR İTTİFAKI']; $MEMLEKET = $sonuclar[1]['MEMLEKET PARTİSİ']; ?> yukarıdaki kodu bot.php olarak kaydedin. [PHPR] <?php include"bot.php"; ?> <!doctype html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://cdn.tailwindcss.com"></script> </head> <body> <div class=" flex justify-center items-center"> <div class="grid grid-cols-4 gap-4"> <div> <div > <img width="" src="https://iasbh.tmgrup.com.tr/4437de/237/323/0/0/394/537?u=https://isbh.tmgrup.com.tr/sbh/2023/05/10/1683720110285.jpg"> </div> <div style="text-align:center; "> <span style="text-align:center; color:#717171;">Recep Tayyip Erdoğan </span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#ffa600; font-weight:bold;">CUMHUR İTTİFAKI</span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#ffa600; font-weight:bold;"><?php echo $CUMHUR;?></span> </div> </div> <div> <div > <img width="" src="https://iasbh.tmgrup.com.tr/4f58ca/237/323/0/0/394/537?u=https://isbh.tmgrup.com.tr/sbh/2023/05/10/1683720165857.jpg"> </div> <div style="text-align:center; "> <span style="text-align:center; color:#717171;">Muharrem İnce </span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#0c61c5; font-weight:bold;">MEMLEKET PARTİSİ</span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#0c61c5; font-weight:bold;"><?php echo $MEMLEKET;?></span> </div> </div> <div> <div > <img width="" src="https://iasbh.tmgrup.com.tr/33ebc0/237/323/0/0/394/537?u=https://isbh.tmgrup.com.tr/sbh/2023/05/10/1683720191622.jpg"> </div> <div style="text-align:center; "> <span style="text-align:center; color:#717171;">Kemal Kılıçdaroğlu </span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#fe0000; font-weight:bold;">MİLLET İTTİFAKI</span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#fe0000; font-weight:bold;"><?php echo $MilletIttifakiyuzde;?></span> </div> </div> <div> <div > <img width="" src="https://iasbh.tmgrup.com.tr/1e3e4f/237/323/0/0/394/537?u=https://isbh.tmgrup.com.tr/sbh/2023/05/10/1683720219229.jpg"> </div> <div style="text-align:center; "> <span style="text-align:center; color:#717171;">Sinan Oğan </span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#4f94af; font-weight:bold;">ATA İTTİFAKI</span> </div> <div style="text-align:center; "> <span style="text-align:center; color:#4f94af; font-weight:bold;"><?php echo $ataIttifakiyuzde;?></span> </div> </div> </div> </div> ?> </body> </html>
[/PHPR]