Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- function gdata($url) {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- return curl_exec($ch);
- curl_close($ch);
- }
- function ganti($teks) {
- $teks = str_replace('<td>', '', $teks);
- $teks = str_replace('</td>', '', $teks);
- $teks = str_replace('</table>', '', $teks);
- return $teks;
- }
- $url = gdata('http://localhost:8080/u.html');
- $str_1 = '</td>';
- $str_2 = '</table>';
- $pos_1 = strpos($url, $str_1);
- $pos_2 = strpos($url, $str_2);
- // echo '<p>awal: '.$pos_1.'</p>';
- // echo '<p>akhir: '.$pos_2.'</p>';
- echo ganti(substr($url, $pos_1, $pos_2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement