Hello.
I want to write an authorization script on ask.fm, but the problem arose already in the first step. In general, there were already many identical problems, in connection with which I was quitting work on this script, but this time I decided to write here. Below is my script. In response, he says that something went wrong, but I think that this is some kind of protection. I am new to authorization on sites through php cUrl, so please be loyal to this issue :)
<?php function get($url = null, $data = array(), $cookie = null) { $ch = curl_init(); $headers = array( "accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "accept-language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4", "user-agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.3.2924.87 Safari/537.36" ); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); if(isset($data)) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } if(isset($cookie)) { curl_setopt($ch, CURLOPT_COOKIE, $cookie); } $response = curl_exec($ch); preg_match_all("/Set-Cookie: (.*?);/", $response, $cookie); $content = substr($response, curl_getinfo($ch, CURLINFO_HEADER_SIZE)); $header = substr($response, 0, curl_getinfo($ch, CURLINFO_HEADER_SIZE)); return array( "content" => $content, "header" => $header, "cookie" => implode(";", $cookie[1]) ); } $homepage = get("https://ask.fm/"); print_r($homepage); ?>