Eh, no więc ;p Chciałem napisać program jaki zaloguje się na stronę https://fronter.com/szkola/
Z wykorzystaniem cURL'a, nawiązałem połączenie ściągnąłem stronę ale nie mogę się zalogować, przy czym nie zapisuję mi się ciasteczko ;p
CURL *curl;
CURLcode result;
struct curl_slist *headers=NULL;
headers = curl_slist_append(headers, "Content-Type: text/html");
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
curl_easy_setopt(curl, CURLOPT_URL,"https://fronter.com/szkola/index.phtml");
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(curl, CURLOPT_COOKIEJAR,"piernik.db");
curl_easy_setopt(curl, CURLOPT_COOKIEFILE,"piernik.db");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
buffer="";
}
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
curl_easy_setopt(curl, CURLOPT_URL,"https://fronter.com/szkola/index.phtml");
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(curl, CURLOPT_POST,TRUE);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"fronter_request_token=d480c27d4578410528c8d1342714d3f8");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"username=UZYTKOWNIK");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"password=HASLO");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"newlang=pl");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"saveid=-1");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"mainurl=main.phtml");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"chp=");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"USER_SCREEN_SIZE=900");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"USER_INITIAL_WINDOW_WIDTH=900");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"USER_INITIAL_WINDOW_HEIGHT=900");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"SSO_COMMAND_SECHASH=4506c1aec525c853422ee32d5526eb08");
curl_easy_setopt(curl, CURLOPT_COOKIEJAR,"piernik.db");
curl_easy_setopt(curl, CURLOPT_COOKIEFILE,"piernik.db");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (result == CURLE_OK)
{
cout<<"\nCODE:\n"<<buffer<<"\n";
html=buffer;
buffer="";
}
else html="none";
}
Nigdy nie robiłem nic na sesjach tym bardziej szyfrowanych, więc proszę o wyrozumienie w idiotycznych błędach ;p
Najbardziej był bym wdzięczny gdyby ktoś znał linka czy coś do kodu pod deva 4.9.9.2 ;p działającego z sesjami na ssl'u
pzd