jpnUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_REFERER, $this->jpnReferer); curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); $return_data = curl_exec($ch); curl_close($ch); return $return_data; } function getNric($nric = '') { $data = $this->nricGrabber($nric); $pattern = '/(.*?)<\/table>/'; preg_match($pattern, $data, $matches, PREG_OFFSET_CAPTURE); $data = $matches[1][0]; $pattern = '/(.*?)<\/span>/'; preg_match_all($pattern, $data, $matches); return $matches[1]; } } //Sample how to use it. echo 'Input format
'; echo 'http://api.ibnuyahya.com/jpn.class.php?nric=999999999999'; if(isset($_GET['nric'])){ $nric = $_GET['nric']; $ayam = new jpn(); $tekek = $ayam->getNric($nric); echo '
';
	print_r($tekek);
	echo '
'; } ?>