Advertisement
Guest User

comot.php

a guest
Nov 17th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.72 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. function gdata($url) {
  4.     $ch = curl_init($url);
  5.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  6.     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  7.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  8. return curl_exec($ch);
  9.     curl_close($ch);
  10. }
  11.  
  12. function ganti($teks) {
  13.     $teks = str_replace('<td>', '', $teks);
  14.     $teks = str_replace('</td>', '', $teks);
  15.     $teks = str_replace('</table>', '', $teks);
  16. return $teks;
  17. }
  18.  
  19. $url = gdata('http://localhost:8080/u.html');
  20.  
  21. $str_1   = '</td>';
  22. $str_2   = '</table>';    
  23. $pos_1 = strpos($url, $str_1);  
  24. $pos_2 = strpos($url, $str_2);  
  25.  
  26. // echo '<p>awal: '.$pos_1.'</p>';  
  27. // echo '<p>akhir: '.$pos_2.'</p>';  
  28. echo ganti(substr($url, $pos_1, $pos_2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement