Created
June 19, 2017 13:16
-
-
Save ammarfaizi2/9a0ecc2fe34a41e0663f10e5da0bd40b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function curl($url, $opt = null){ | |
$ch = curl_init($url); | |
$op = array( | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_SSL_VERIFYPEER => false, | |
CURLOPT_SSL_VERIFYHOST => false, | |
CURLOPT_USERAGENT => "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:46.0) Gecko/20100101 Firefox/46.0" | |
); | |
if (is_array($opt)) { | |
foreach ($opt as $key => $value) { | |
$op[$key] = $value; | |
} | |
} | |
curl_setopt_array($ch, $op); | |
$out = curl_exec($ch); | |
$err = curl_error($ch) and $out = $err; | |
curl_close($ch); | |
return $out; | |
} | |
$baseurl = "http://seleksi.smkn5-tng.com/"; | |
$pure_source = curl($baseurl); | |
$a = explode("href=\"", $pure_source); | |
for ($i=1; $i < count($a); $i++) { | |
$b = explode("\"", $a[$i], 2); | |
$b = html_entity_decode($b[0], ENT_QUOTES, 'UTF-8'); | |
if (strpos($b, "//")===false) { | |
$pure_source = str_replace($b, htmlspecialchars($baseurl.$b, ENT_QUOTES, 'UTF-8'), $pure_source); | |
} | |
} | |
$a = explode("src=\"", $pure_source); | |
for ($i=1; $i < count($a); $i++) { | |
$b = explode("\"", $a[$i], 2); | |
$b = html_entity_decode($b[0], ENT_QUOTES, 'UTF-8'); | |
if (strpos($b, "//")===false) { | |
$pure_source = str_replace($b, htmlspecialchars($baseurl.$b, ENT_QUOTES, 'UTF-8'), $pure_source); | |
} | |
} | |
#var_dump($a); | |
print $pure_source; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment