PDA

View Full Version : Login to www.getfile.pl



oski225
9th August 2009, 17:13
Hi,
I want to login to getfile.pl and download content of webpage as logged user.
This is API http://getfile.pl/article_9_API
And my code

QHttpRequestHeader header("POST", "/api.php");;
header.setValue("Host", "www.getfile.pl");
header.setValue("Get","mode=login");
header.setContentType("application/x-www-form-urlencoded");
QString loginString = "login=login&password=pass";
m_http->setHost("www.getfile.pl");
m_http->request(header, loginString.toUtf8());

But this code is bad...


This is response serwer:


HTTP/1.1 302 Found
Date: Sat, 08 Aug 2009 21:57:49 GMT
Server: Apache/2
Set-Cookie: PHPSESSID=sn9j1hfp13hp35efqs9bq8ved2; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=sn9j1hfp13hp35efqs9bq8ved2; expires=Sat, 08-Aug-2009 22:27:49 GMT; path=/; domain=getfile.pl
Set-Cookie: PHPSESSID=sn9j1hfp13hp35efqs9bq8ved2; expires=Sat, 08-Aug-2009 22:27:49 GMT; path=/; domain=ssl.getfile.pl
Connection: close
location: http://getfile.pl/
Content-Length: 0
Content-Type: text/html; charset=UTF-8



Please help me:(
PS: Sorry for my terrible English...

wysota
9th August 2009, 19:44
But what exactly do you want us to do? The server responds with a regular cached response, you probably didn't send a proper request.

oski225
9th August 2009, 20:22
In this moment I want to get webpage as logged user.

wysota
9th August 2009, 23:12
Ok, but how do you think we could help you? Right now I can only advise to take a network sniffer, check the traffic expected by the webserver (for example as sent by a web browser) and compare it to the one of your program. Then change your program to emit a proper request to the server.

oski225
10th August 2009, 00:53
But I do like is written in the API, although it does not refer the server log whether I was successful or not

oski225
10th August 2009, 14:56
Please give me example login to forum/site

numbat
11th August 2009, 05:52
Why do you say it is not working? The response sets cookies and redirects to getfile.pl. The problem may be that QHttp does not automatically handle cookies. Why don't you use QNetworkAccessManager instead, which handles cookies?

oski225
20th August 2009, 17:55
Ok, big thx ;)