.php dosyasının bulunduğu klasöre boş cookie.txt dosyayı oluştumayı unutma :)
Kod:
function login($url){
$fp = fopen("cookie.txt", "w");
fclose($fp);
$login = curl_init();
curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($login, CURLOPT_TIMEOUT, 40000);
curl_setopt($login, CURLOPT_RETURNTRANSFER,1);
curl_setopt($login, CURLOPT_URL, $url);
curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($login, CURLOPT_POST,1);
curl_setopt($login, CURLOPT_POSTFIELDS, $data);
ob_start();
$cikti = curl_exec($login);
ob_end_clean();
curl_close ($login);
return str_replace(array("\n", "\t", "\r"), null, $cikti);
}
$site = "https://www.agoda.com/tr-tr/pages/agoda/default/DestinationSearchResult.aspx?checkIn=2018-02-24&checkOut=2018-02-25¤cyId=176¤cyCode=TRY&selectedproperty=85&city=5085&los=1&cid=-999&sort=agodaRecommended";
$baglan = login($site);
preg_match_all('@(.*?)@', $baglan , $test);
$vmvericek = $test[1];
echo $vmvericek;
?>