<?php
$numara = "5441234567";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://www.turkiye.gov.tr/btk-numara-tasima?submit");
curl_setopt($curl, CURLOPT_REFERER, "https://www.turkiye.gov.tr/");
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl, CURLOPT_COOKIEFILE, 'cerez.txt');
curl_setopt($curl, CURLOPT_COOKIEJAR, 'cerez.txt');
preg_match('#<input type="hidden" name="token" value="(.*?)">#si', curl_exec($curl), $token);
$post_bilgileri = "txtMsisdn=$numara&token=".urlencode($token[1]);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_bilgileri);
$icerik = curl_exec($curl);
if(curl_exec($curl) === false){
echo 'Curl error: ' . curl_error($curl);
}else{
preg_match('#<div class="reminderContainer">(.*?)</div>#si', $icerik, $sonuc);
echo $sonuc[1];
}
curl_close($curl);
?>