Help find the php script, authorization via classmates API. I can not find …
Thank you in advance for your help!
Answer 1, Authority 100%
And here’s something else:
& lt;? php
$ User_Agent = 'Mozilla / 5.0 (Windows; U; Windows NT 6.0; RU; RV: 1.9.2.13)'.
'GECKO / 20101203 Firefox / 3.6.13 (.NET CLR 3.5.30729)';
$ login = 'login';
$ password = 'password';
$ ch = curl_init ();
CURL_SETOPT ($ CH, CURLOPT_POST, TRUE);
CURL_SETOPT ($ CH, CURLOPT_USERAGENT, $ User_Agent);
CURL_SETOPT ($ CH, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ ch, curlopt_cookiefile, dirname (__ file__). '/Cookie.txt');
CURL_SETOPT ($ CH, CURLOPT_COOKIEJAR, DIRNAME (__ File__). '/Cookie.txt');
curl_setopt ($ CH, Curlopt_Header, True);
CURL_SETOPT ($ CH, CURLOPT_TIMEOUT, 10);
CURL_SETOPT ($ CH, CURLOPT_FOLLOCATION, TRUE);
curl_setopt ($ CH, Curlopt_URL, 'http://www.odnoklassniki.ru/dk?cmd=anonymlogin& ;st.cmd=anonymlogin&
$ post = array (
'st.Redirect' = & gt; ''
'st.posted' = & gt; 'set',
'St.Email' = & gt; $ Login
'st.password' = & gt; $ password,
'st.screensize' = & gt; ''
'St.BrowSerSe' = & gt; ''
'st.flashver' = & gt; "'
);
curl_setopt ($ ch, curlopt_postfields, http_build_query ($ post));
$ Answer = CURL_EXEC ($ CH);
// In response got the main page
Echo $ Answer;
CURL_CLOSE ($ CH);
Answer 2, Authority 50%
probably something like this
& lt;? // this.php
$ client_secret = 'Secret key of the application';
$ clientid = 'application identifier';
$ scope = 'List of access rights';
FUNCTION SEND_POST ($ Post_url, $ post_data)
{
$ ch = curl_init ();
CURL_SETOPT ($ CH, CURLOPT_URL, $ post_url);
CURL_SETOPT ($ CH, Curlopt_returntransfer, True);
CURL_SETOPT ($ ch, curlopt_cookiejar, "coocie.dat");
CURL_SETOPT ($ ch, curlopt_cookiefile, "coocie.dat");
CURL_SETOPT ($ CH, CURLOPT_POST, TRUE);
curl_setopt ($ ch, curlopt_postfields, $ post_data);
curl_setopt ($ ch, curlopt_connecttimeout, 30);
curl_setopt ($ CH, Curlopt_useragent, "Mozilla / 5.0 (Windows NT 6.1; RV: 9.0.1) GECKO / 20100101 Firefox / 9.0.1");
$ Data = CURL_EXEC ($ CH);
CURL_CLOSE ($ CH);
Return $ Data;
};
if (Empty ($ _ Get ['Code']))
{
HEADER ('Location http://www.odnoklassniki.ru/oauth/authorize?client_id=$ClientIn&cope=$scope& ;respondse_type=code& ;redirect_uri=http://site/this.php');
} else {
$ url = 'http: //api.odnoklassniki.ru/oauth/token.do';
$ Data = Array (
'Code' = & gt; $ _ get ['Code'],
'redirect_uri' = & gt; 'http: //site/this.php',
'grant_type' = & gt; 'authorization_code',
'Client_ID' = & gt; $ clientid,
'Client_Secret' = & gt; $ client_secret
)
$ data = json_decode (Send_Post ($ URL, $ Data));
$ token = $ Data- & gt; access_token;
}
For more information about the parameters, see the link above.
Requests for the API do transmitting in the parameters received access_token