Skip to content

emka.web.id

menulis pengetahuan – merekam peradaban

Menu
  • Home
  • Tutorial
  • Search
Menu

Belajar PHP: Menampilkan Hotthread Kaskus pada Website dengan PHP

Posted on May 31, 2012

Kaskus saat ini merupakan forum terbesar di Indonesia. Hotthreads atau tulisan-tulisan unggulan yang ditampilkan di halaman depan kaskus berubah-ubah tiap hari. Hotthread inilah yang akan coba kita tampilkan pada website kita. Skrip akan ditulis dengan bahasa PHP dan memanfaatkan cURL. Tutorial ini diilhami oleh plugin WordPress Kaskus-Hot-Threads.

Berikut sourcecodenya:

[sourcecode language=”php”]
<?php
// function-function umum
function file_get_contents_curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}

function getht(){
$data=file_get_contents_curl("http://www.kaskus.us/");
preg_match(‘/(<ul>)(.*)/’, $data, $p);
preg_match(‘/(.*)(<\/ul>)/’, $p[2], $s);
return $s[1];
}

function showht() {
$ht = getht();
$href1 = str_replace(‘showthread’,’http://www.kaskus.us/showthread’,$ht);
$strong1 = str_replace(‘<strong>’,”,$href1);
$strong2 = str_replace(‘</strong>’,”,$strong1);
echo $strong2;
}

//menampilkan hot threads kaskus
echo ‘<ul>’;
showht();
echo ‘</ul>’;
?>
[/sourcecode]

Berikut demonstrasinya:
‘;
showht();
echo ‘

‘;
?>

Terbaru

  • XBox Game Pass PC Tidak Bisa Address GPU ke Game
  • Your Pocket-Sized Doctors: 3 Health Apps Changing the Game on Android and iOS
  • Waymo Bawa Teknologi ‘Liquid Glass’ untuk Mobil Otonom
  • Rumor Google Akan Update UI Besar-besaran Desember 2025
  • Gemini Akan Masuk di Android Auto, Mobil Jadi Lebih Smart!
  • OpenAI Bantah Rencana Pasang Iklan di ChatGPT Berlangganan
  • Kenapa Komputer Sangat Panas Saat Gunakan Fitur Virtualisasi Hyper-V?
  • Apa itu Bug React2Shell? Sudah Serang Lebih dari 30 Organisasi dan 77.000 IP Address
  • Google Store Black Friday 2025: Penawaran Spesial untuk Pixel, Nest, dan Lainnya!
  • Boxville 2 Gratis di Playstore, Plus Diskon Lainnya!
  • Cara Atasi Masalah Pembacaan Suara (Read Aloud) di Windows Copilot Tidak Berfungsi
  • Kementerian Kesehatan Inggris Akui Data Breach, Akibat Zero-day Oracle DB?
  • Google Akan Perkenalkan Autofill Google Wallet di Chrome untuk Pembayaran Lebih Mudah
  • Google Pixel Akan Perkenalkan Launcher Device Search Baru, Lebih Cepat dan Pintar
  • Hacker Serang Bug VPN di ArrayOS AG untuk Menanam Web Shell
  • Cara Menonaktifkan Error “ITS Almost time to restart in Windows”
  • Google Fi Mendukung Panggilan Telepon RCS Melalui Web, Lebih Mudah dan Efisien
  • Data Breach Marquis: Hajar Lebih Dari 74 Bank dan Koperasi AS
  • Google Search Akan Adopsi ‘Continuous Circle’ untuk Hasil Pencarian Terjemahan, Lebih Cerdas dan Kontekstual
  • Rusia Memblokir Roblox Karena Distribusi ‘Propaganda LGBT’
  • Google Gemini Redesain Web Total di Desember 2025, Fokus UX yang Lebih Baik
  • Apa itu Google Workspace Studio? Tool Baru untuk Pembuat Konten?
  • Cara Menggunakan Xbox Full-Screen Experience di Windows
  • Korea Tahan Tersangka Terkait Penjualan Video Intim dari Kamera CCTV yang Diretas
  • Kebocoran Galaxy Buds 4 Mengungkap Desain dan Fitur Baru, Mirip Apple?
  • Sudah Update Windows KB5070311 dan Apa Saja Yang Diperbaiki?
  • Cara Menonaktifkan Fitur AI Actions (Tindakan AI) di Menu Windows Explorer
  • Microsoft Edge AI vs. OpenAI’s Atlas Browser: Perbandingan dan Perbedaan Utama
  • Cara Memasang Folder Sebagai Drive di Windows 11
  • Cara Memperbaiki Error 0xC1900101 0x40021 pada Update Windows 11
  • XBox Game Pass PC Tidak Bisa Address GPU ke Game
  • Your Pocket-Sized Doctors: 3 Health Apps Changing the Game on Android and iOS
  • Waymo Bawa Teknologi ‘Liquid Glass’ untuk Mobil Otonom

©2025 emka.web.id | Design: Newspaperly WordPress Theme