Witam, mój admin zrobił taki myk,że przy kazdym włączeniu komputera po uruchomieniu przeglądarki muszę wpisać w formularz login i hasło (kicia/kicia).
Source strony do logowania: http://nopaste.gamedev.pl/?id=1267
Robie program,który to zautomatyzuje przy pomocy curla. Mam taki kod:
#include <curl/curl.h>
int main()
{
CURL *curl;
CURLcode res;
char *url="http://10.1.10.101";
char *method_post="username=kicia&password=kicia";
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "ciacho.txt");
curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "ciacho.txt");
curl_easy_setopt(curl, CURLOPT_COOKIESESSION, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 1);
curl_easy_setopt(curl, CURLOPT_USERAGENT,"Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.6;");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, method_post);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
Włączam i ukazuje się moim oczom:
* About to connect() to 10.1.10.101 port 80
* Trying 10.1.10.101... * connected
* Connected to 10.1.10.101 (10.1.10.101) port 80
> POST / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.1.9) Gecko/20071
025 Firefox/2.0.0.6;
Host: 10.1.10.101
Accept: */*
Content-Length: 29
Content-Type: application/x-www-form-urlencoded
username=kicia&password=kicia< HTTP/1.1 303 Hotspot login required
HTTP/1.1 303 Hotspot login required
< Cache-Control: no-cache
Cache-Control: no-cache
< Connection: Keep-Alive
Connection: Keep-Alive
< Content-Length: 135
Content-Length: 135
< Content-Type: text/html
Content-Type: text/html
< Date: Sat, 03 Nov 2007 18:37:32 GMT
Date: Sat, 03 Nov 2007 18:37:32 GMT
< Expires: 0
Expires: 0
< Location: http://10.1.10.101/login
Location: http://10.1.10.101/login
<html>
<head><title>Error 303: Hotspot login required</title></head>
<body>
<h1>Error 303: Hotspot login required</h1>
</body>
</html>
* Connection #0 to host 10.1.10.101 left intact
* Closing connection #0
Co jest źle, że wywala Error 303: Hotspot login required?
Prócz curla próbowałem też w C++/cli w Visual 2005 EE zrobić aplet IE i wrzucić tam przez GET, ale cóż za dużo pamięciożerne i nie wyszło, jak i z Wininiet.