Created
July 2, 2015 12:22
-
-
Save kamarasta201/95c815a0e6ca0885c33f to your computer and use it in GitHub Desktop.
grab mudik gratis
This file contains 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
public function getMudikgratis() | |
{ | |
$url = ("http://mudikgratis.dephub.go.id/"); | |
$curl = curl_init($url); | |
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); | |
$page = curl_exec( $curl ); | |
$d = new DOMDocument(); | |
libxml_use_internal_errors(true); | |
$d->loadHTML(preg_replace('!\s+!', ' ', str_replace("\xA0", '', $page))); | |
libxml_use_internal_errors(false); | |
$xpath = new DOMXPath($d); | |
$result = array(); | |
$domElement = $xpath->evaluate('//*[@id="laut"]/table')->item(0); | |
$outerHTML = $domElement->ownerDocument->saveXML($domElement); | |
return $outerHTML; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment