Advertisement
Guest User

chilkathttp

a guest
May 8th, 2013
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.24 KB | None | 0 0
  1. Hi, i want to make a very basic login to get my messages from a forum i use, i got the OK from the forum Administrator to use automatic software to login to my account and i'm trying to do this:
  2. <code>
  3. Chilkat.Http http = new Chilkat.Http();
  4. http.UnlockComponent("xxxxxxxxxxxxxxx");
  5. http.SessionLogFilename = "c:/temp/httpSessionLog.txt";
  6. http.CookieDir = "memory";
  7. http.SaveCookies = true;
  8. http.MimicFireFox = true;
  9. http.FollowRedirects = true;
  10. http.SetRequestHeader("Accept-Encoding", "gzip, deflate");
  11. http.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  12. http.SetRequestHeader("Accept-Language", "en-us");
  13. http.SetRequestHeader("Referer", "http://forums.vwvortex.com/forum.php");
  14. http.SetRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)");
  15. http.SetRequestHeader("Accept", "application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*");
  16. Chilkat.HttpRequest post = new Chilkat.HttpRequest();
  17. post.AddParam("s", "");
  18. post.AddParam("securitytoken", "guest");
  19. post.AddParam("vb_login_md5password", "");
  20. post.AddParam("vb_login_md5password_utf", "");
  21. post.AddParam("vb_login_password", "yyyyyyy"); //my password
  22. post.AddParam("vb_login_password_hint", "Password");
  23. post.AddParam("vb_login_username", "xxxxxxxx"); //my username
  24. post.HttpVerb = "POST";
  25. post.UsePost();
  26. post.ContentType = "application/x-www-form-urlencoded";
  27. Chilkat.HttpResponse html = http.PostUrlEncoded("http://forums.vwvortex.com/login.php?do=login", post);
  28. string htmlretur = html.BodyStr;
  29. var a = http.LastErrorText;
  30. var b = http.LastHeader;
  31. http.SendCookies = true;
  32. // everything seems to be OK until here, i get the welcome message and everyting, but when i try to mavigate to another page i am not logged in... I think it's some cookie problem..
  33. ret = http.QuickGetStr("http://forums.vwvortex.com/");
  34. a = http.LastErrorText;
  35. b = http.LastHeader;
  36. </code>
  37.  
  38. here is the httpsessionlog
  39. <code>
  40. http://pastebin.com/kp7pf8Kn
  41. </code>
  42. here is the LastErrorText for the post
  43.  
  44. http://pastebin.com/3Et3tLCX
  45.  
  46. <code>
  47. ChilkatLog:
  48. PostUrlEncoded:
  49. DllDate: Dec 12 2012
  50. UnlockPrefix: DAVIDHHttp
  51. Username: EVENTS:Administrator
  52. Architecture: Little Endian; 32-bit
  53. Language: .NET 4.0
  54. VerboseLogging: 0
  55. url: http://forums.vwvortex.com/login.php?do=login
  56. sessionLogFilename: c:/temp/httpSessionLog.txt
  57. RequestData:
  58. HttpVersion: 1.1
  59. Verb: POST
  60. Path: /
  61. Charset: windows-1252
  62. SendCharset: 0
  63. MimeHeader: Content-Type: application/x-www-form-urlencoded
  64. RequestParams:
  65. RequestItem:
  66. name: s
  67. value:
  68. --RequestItem
  69. RequestItem:
  70. name: securitytoken
  71. value: guest
  72. --RequestItem
  73. RequestItem:
  74. name: vb_login_md5password
  75. value:
  76. --RequestItem
  77. RequestItem:
  78. name: vb_login_md5password_utf
  79. value:
  80. --RequestItem
  81. RequestItem:
  82. name: vb_login_password
  83. value: yyyyyyyyy
  84. --RequestItem
  85. RequestItem:
  86. name: vb_login_password_hint
  87. value: Password
  88. --RequestItem
  89. RequestItem:
  90. name: vb_login_username
  91. value: xxxxxxxx
  92. --RequestItem
  93. --RequestParams
  94. --RequestData
  95. httpConnect:
  96. hostname: forums.vwvortex.com
  97. port: 80
  98. ssl: 0
  99. Need to establish connection to the HTTP server...
  100. ConnectTimeoutMs_1: 120000
  101. calling ConnectSocket2
  102. IPV6 enabled connect with NO heartbeat.
  103. connectingTo: forums.vwvortex.com
  104. resolveHostname1:
  105. dnsCacheLookup: forums.vwvortex.com
  106. Resolving domain name (IPV4)
  107. --resolveHostname1
  108. GetHostByNameHB_ipv4: Elapsed time: 171 millisec
  109. myIP_1: 172.158.18.252
  110. myPort_1: 1500
  111. connect successful (1)
  112. Turning on TCP_NODELAY.
  113. socketOptions:
  114. SO_SNDBUF: 8192
  115. SO_RCVBUF: 8192
  116. TCP_NODELAY: 1
  117. --socketOptions
  118. Connected
  119. --httpConnect
  120. connectTime1: Elapsed time: 500 millisec
  121. sendRequestGetResponse_1:
  122. sendRequest:
  123. Adding Host header...
  124. host: forums.vwvortex.com
  125. port: 80
  126. Auto-adding any accumulated cookies.
  127. CookieDir: memory
  128. CookieDomain: forums.vwvortex.com
  129. CookiePath: /login.php
  130. LoadCookieJar:
  131. Path: /login.php
  132. GetDomainCookiesXml:
  133. CookieDir: memory
  134. Domain: forums.vwvortex.com
  135. HashKey: vwvortex_com.xml
  136. No cookies exist yet.
  137. --GetDomainCookiesXml
  138. --LoadCookieJar
  139. No cookie jar found.
  140. --sendRequest
  141. sendRequestTime: Elapsed time: 0 millisec
  142. ---- Reading HTTP Response ----
  143. readResponse2_4:
  144. ConnectionRespHdr: close
  145. fetchNonSslResponseData2_4:
  146. Reading chunked response
  147. --fetchNonSslResponseData2_4
  148. Closing HTTP connection because of Connection:close header. (or proxy-connection:close header)
  149. Saving cookies...
  150. defaultCookieDomain: forums.vwvortex.com
  151. Cookie:
  152. Name: bb_sessionhash
  153. Value: e972b78dd358b4a5da6814c558be054f
  154. Domain: forums.vwvortex.com
  155. Path: /
  156. Expire:
  157. --Cookie
  158. SaveCookie:
  159. CookieDir: memory
  160. Domain: forums.vwvortex.com
  161. HashKey: vwvortex_com.xml
  162. --SaveCookie
  163. Cookie:
  164. Name: bb_lastvisit
  165. Value: 1368033680
  166. Domain: forums.vwvortex.com
  167. Path: /
  168. Expire: Thu, 08-May-2014 17:21:20 GMT
  169. --Cookie
  170. SaveCookie:
  171. CookieDir: memory
  172. Domain: forums.vwvortex.com
  173. HashKey: vwvortex_com.xml
  174. --SaveCookie
  175. Cookie:
  176. Name: bb_lastactivity
  177. Value: 0
  178. Domain: forums.vwvortex.com
  179. Path: /
  180. Expire: Thu, 08-May-2014 17:21:20 GMT
  181. --Cookie
  182. SaveCookie:
  183. CookieDir: memory
  184. Domain: forums.vwvortex.com
  185. HashKey: vwvortex_com.xml
  186. --SaveCookie
  187. Cookie:
  188. Name: SERVERID
  189. Value:
  190. Domain: forums.vwvortex.com
  191. Path: /
  192. Expire: Thu, 01-Jan-1970 00:00:01 GMT
  193. --Cookie
  194. SaveCookie:
  195. CookieDir: memory
  196. Domain: forums.vwvortex.com
  197. Cookie is expired. Not saving...
  198. expiration: Thu, 01-Jan-1970 00:00:01 GMT
  199. bDateParsed: 1
  200. parsedExpDateTime: Thu, 01 Jan 1970 00:00:01 GMT
  201. --SaveCookie
  202. readResponseTime: Elapsed time: 421 millisec
  203. --readResponse2_4
  204. processResponse_3:
  205. responseStatus: 200
  206. --processResponse_3
  207. --sendRequestGetResponse_1
  208. Success.
  209. --PostUrlEncoded
  210. --ChilkatLog
  211. </code>
  212.  
  213. and this is the LastErrorText for the next GET, the result html is OK but i am not logged in...
  214.  
  215. http://pastebin.com/mKV1EPym
  216.  
  217. <code>
  218. ChilkatLog:
  219. QuickGetStr:
  220. DllDate: Dec 12 2012
  221. UnlockPrefix: DAVIDHHttp
  222. Username: EVENTS:Administrator
  223. Architecture: Little Endian; 32-bit
  224. Language: .NET 4.0
  225. VerboseLogging: 0
  226. QuickReq:
  227. url: http://forums.vwvortex.com/
  228. QuickGetToOutput_OnExisting:
  229. qGet_1:
  230. simpleHttpRequest_3:
  231. httpMethod: GET
  232. requestUrl: http://forums.vwvortex.com/
  233. Connecting to web server...
  234. httpServer: forums.vwvortex.com
  235. port: 80
  236. ConnectTimeoutMs_1: 120000
  237. calling ConnectSocket2
  238. IPV6 enabled connect with NO heartbeat.
  239. connectingTo: forums.vwvortex.com
  240. resolveHostname1:
  241. dnsCacheLookup: forums.vwvortex.com
  242. dnsCacheHit: 199.193.245.42
  243. --resolveHostname1
  244. GetHostByNameHB_ipv4: Elapsed time: 0 millisec
  245. myIP_1: 172.158.18.252
  246. myPort_1: 1503
  247. connect successful (1)
  248. Turning on TCP_NODELAY.
  249. socketOptions:
  250. SO_SNDBUF: 8192
  251. SO_RCVBUF: 8192
  252. TCP_NODELAY: 1
  253. --socketOptions
  254. connectElapsedMs: 172
  255. -- BuildFireFoxGetRequest --
  256. Auto-adding any accumulated cookies.
  257. CookieDir: memory
  258. CookieDomain: forums.vwvortex.com
  259. CookiePath: /
  260. LoadCookieJar:
  261. Path: /
  262. GetDomainCookiesXml:
  263. CookieDir: memory
  264. Domain: forums.vwvortex.com
  265. HashKey: vwvortex_com.xml
  266. --GetDomainCookiesXml
  267. --LoadCookieJar
  268. AddingCookie: bb_sessionhash=e972b78dd358b4a5da6814c558be054f; bb_lastvisit=1368033680; bb_lastactivity=0
  269. sendElapsedMs: 0
  270. Saving cookies...
  271. defaultCookieDomain: forums.vwvortex.com
  272. Cookie:
  273. Name: bb_sessionhash
  274. Value: ab2c97b9bfadc43b0280ba27584afab9
  275. Domain: forums.vwvortex.com
  276. Path: /
  277. Expire:
  278. --Cookie
  279. SaveCookie:
  280. CookieDir: memory
  281. Domain: forums.vwvortex.com
  282. HashKey: vwvortex_com.xml
  283. --SaveCookie
  284. Cookie:
  285. Name: bb_lastactivity
  286. Value: 0
  287. Domain: forums.vwvortex.com
  288. Path: /
  289. Expire: Thu, 08-May-2014 17:22:43 GMT
  290. --Cookie
  291. SaveCookie:
  292. CookieDir: memory
  293. Domain: forums.vwvortex.com
  294. HashKey: vwvortex_com.xml
  295. --SaveCookie
  296. Cookie:
  297. Name: SERVERID
  298. Value:
  299. Domain: forums.vwvortex.com
  300. Path: /
  301. Expire: Thu, 01-Jan-1970 00:00:01 GMT
  302. --Cookie
  303. SaveCookie:
  304. CookieDir: memory
  305. Domain: forums.vwvortex.com
  306. Cookie is expired. Not saving...
  307. expiration: Thu, 01-Jan-1970 00:00:01 GMT
  308. bDateParsed: 1
  309. parsedExpDateTime: Thu, 01 Jan 1970 00:00:01 GMT
  310. --SaveCookie
  311. StatusCode: 200
  312. StatusText: OK
  313. Reading response body...
  314. fetchNonSslResponseData2_2:
  315. Reading chunked response
  316. --fetchNonSslResponseData2_2
  317. readResponseElapsedMs: 922
  318. CompressedSize: 8544
  319. Got connection:close header
  320. --simpleHttpRequest_3
  321. --qGet_1
  322. --QuickGetToOutput_OnExisting
  323. --QuickReq
  324. responseSize: 32457
  325. responseContentType: text/html; charset=ISO-8859-1
  326. This is a text response...
  327. ResponseHdrCharset: ISO-8859-1
  328. Converting to utf-8 charset.
  329. ConvertFromCodePage: 28591
  330. NumUtf8Bytes: 32461
  331. Success.
  332. --QuickGetStr
  333. --ChilkatLog
  334.  
  335. </code>
  336.  
  337.  
  338.  
  339.  
  340. Any idea why ? Or what am i doing wrong? i tested with my browser, Active Scripting Disabled with both Firefox and IE 8 and it works.
  341.  
  342.  
  343.  
  344. I recorded my actions and i get this, Recorded with IE 8:
  345.  
  346.  
  347.  
  348. <code>
  349. POST /login.php?do=login HTTP/1.1
  350. Accept: application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
  351. Referer: http://forums.vwvortex.com/forum.php
  352. Accept-Language: en-us
  353. User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
  354. Content-Type: application/x-www-form-urlencoded
  355. Accept-Encoding: gzip, deflate
  356. Host: forums.vwvortex.com
  357. Content-Length: 168
  358. Connection: Keep-Alive
  359. Cache-Control: no-cache
  360. Cookie: bb_lastvisit=1368022979; bb_lastactivity=0
  361.  
  362. vb_login_username=xxxxxxxxxxxx&vb_login_password_hint=Password&vb_login_password=yyyyyyyyyy&s=&securitytoken=guest&do=login&vb_login_md5password=&vb_login_md5password_utf=
  363. </code>
  364.  
  365.  
  366.  
  367. received:
  368.  
  369.  
  370. <code>
  371. HTTP/1.1 200 OK
  372. Content-Encoding: gzip
  373. Vary: Accept-Encoding
  374. Transfer-Encoding: chunked
  375. Date: Wed, 08 May 2013 14:23:27 GMT
  376. Server: LiteSpeed
  377. Connection: close
  378. X-Powered-By: PHP/5.3.2
  379. Set-Cookie: bb_lastactivity=0; expires=Thu, 08-May-2014 14:23:27 GMT; path=/
  380. Set-Cookie: bb_sessionhash=09a44477f40262cab54b2cfa7f3cb07f; path=/; HttpOnly
  381. Cache-Control: private
  382. Pragma: private
  383. Content-Type: text/html; charset=ISO-8859-1
  384. Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
  385.  
  386. 683
  387. gziped html here ...
  388. </code>
  389.  
  390.  
  391.  
  392. redirect to : http://forums.vwvortex.com/forum.php
  393. My browser sends :
  394.  
  395.  
  396. <code>
  397. GET /forum.php HTTP/1.1
  398. Accept: application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
  399. Accept-Language: en-us
  400. User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
  401. Accept-Encoding: gzip, deflate
  402. Host: forums.vwvortex.com
  403. Connection: Keep-Alive
  404. Cookie: bb_lastvisit=1368022979; bb_lastactivity=0; bb_sessionhash=09a44477f40262cab54b2cfa7f3cb07f
  405.  
  406. </code>
  407.  
  408.  
  409.  
  410. Receive :
  411.  
  412.  
  413. <code>
  414. HTTP/1.1 200 OK
  415. Content-Encoding: gzip
  416. Vary: Accept-Encoding
  417. Transfer-Encoding: chunked
  418. Date: Wed, 08 May 2013 14:23:30 GMT
  419. Server: LiteSpeed
  420. Connection: close
  421. X-Powered-By: PHP/5.3.2
  422. Cache-Control: private
  423. Pragma: private
  424. Content-Type: text/html; charset=ISO-8859-1
  425. Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
  426. </code>
  427.  
  428.  
  429.  
  430. 1000
  431.  Gzip content here ....
  432.  
  433.  
  434. and i remain logged in for example if i go to:
  435.  
  436.  
  437. <code>
  438. GET /forumdisplay.php?5080-The-Car-Lounge HTTP/1.1
  439. Accept: application/x-shockwave-flash, image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
  440. Referer: http://forums.vwvortex.com/forum.php
  441. Accept-Language: en-us
  442. User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
  443. Accept-Encoding: gzip, deflate
  444. Host: forums.vwvortex.com
  445. Connection: Keep-Alive
  446. Cookie: bb_lastvisit=1368022979; bb_lastactivity=0; bb_sessionhash=09a44477f40262cab54b2cfa7f3cb07f
  447. </code>
  448.  
  449.  
  450.  
  451. and the response :
  452.  
  453.  
  454. <code>
  455. HTTP/1.1 200 OK
  456. Content-Encoding: gzip
  457. Vary: Accept-Encoding
  458. Transfer-Encoding: chunked
  459. Date: Wed, 08 May 2013 15:06:42 GMT
  460. Server: LiteSpeed
  461. Connection: close
  462. X-Powered-By: PHP/5.3.2
  463. Set-Cookie: bb_sessionhash=192be09d402793184ef59a400efd05bf; path=/; HttpOnly
  464. Set-Cookie: bb_lastvisit=1368022979; expires=Thu, 08-May-2014 15:06:42 GMT; path=/
  465. Set-Cookie: bb_lastactivity=0; expires=Thu, 08-May-2014 15:06:42 GMT; path=/
  466. Cache-Control: private
  467. Pragma: private
  468. Content-Type: text/html; charset=ISO-8859-1
  469. Set-Cookie: SERVERID=; Expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/
  470. </code>
  471.  
  472.  
  473. html here and i am logged in...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement