<?php
error_reporting(E_ALL); ini_set("display_errors", 1);
# First call gets hidden form field authenticity_token
# and session cookie
$ch = curl_init();
$sTarget = "https://www.nic.tr/";
curl_setopt($ch, CURLOPT_URL, $sTarget);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
curl_setopt($ch, CURLOPT_REFERER, "https://www.nic.tr/");
$html = curl_exec($ch);
# parse authenticity_token out of html response
preg_match('/<input type="hidden" name="PHPSESSID" value="([a-zA-Z0-9]*)">/', $html, $match);
$authenticity_token = $match[1];
$username = "****-metu";
$password = "*****";
# set post data
$sPost = "newHandle=$username&password=$password&authenticity_token=$authenticity_token&mainLoginSubmit=GİRİŞ";
# second call is a post and performs login
$sTarget = "https://www.nic.tr/index.php";
curl_setopt($ch, CURLOPT_URL, $sTarget);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $sPost);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded"));
# display server response
$yeni=curl_exec($ch);
preg_match('@<title>(.*?)</title>@si',$yeni,$bak);
echo $bak[1];
curl_close($ch);
?>preg_match('@<title>(.*?)</title>@si',$yeni,$bak);echo $bak[1];

işini fazlasıile görür