Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- syaratnya cuman udah di export doang xmlnya, biar bisa di update
- ewat mysql
- edan sih mwb -,-, hasil import link post jadi kek eeq
- */
- function tengah($string, $awal, $akhir){
- $string = " ".$string;
- $strings = strpos($string,$awal);
- if ($strings == 0) return "";
- $strings += strlen($awal);
- $antara = strpos($string,$akhir,$strings) - $strings;
- return substr($string,$strings,$antara);
- }
- // ganti coker sama file cooki login mywapblogmu
- function auto($url){
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL,$url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($curl, CURLOPT_COOKIEFILE, 'coker');
- $ch = curl_exec($curl);
- curl_close($curl);
- return($ch);
- }
- // Dari wp-config
- $db = '';
- $user = '';
- $pass = '';
- $host = 'localhost';
- $conn = mysql_connect($host, $user, $pass, $db);
- if(!$conn){
- die("Connection failed");
- }else{
- echo "oke";
- }
- mysql_select_db($db);
- // 17 = jumlah page di link bawah itu
- for($i=1;$i<=17;$i++){
- $a = explode("<a", tengah(auto("http://www.mywapblog.com/id/manage_post.php?page_num=$i"), "<ol>", "</ol>"));
- foreach($a as $b){
- $full = tengah($b, 'href="', '</a>');
- if(ereg('xhtml', $full)){
- // ganti nijigen-kun sama domen mwbmu
- $ganti = array('http://www.nijigen-kun.id/', '.xhtml',);
- $link = str_replace($ganti, "",substr($full, 0, strpos($full, '"')));
- $judul = substr($full, strpos($full, '>')+1);
- $query = "UPDATE wp_posts SET post_name='$link' WHERE post_title='$judul'" ;
- $hasil = mysql_query($query);
- if($hasil) {
- echo $link.'<br>'.$judul.'<br>SUKSES<hr>';
- }else{
- echo $link.'<br>'.$judul.'<br>GAGAL<hr>';
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement