Hi there,
I am in a fairly awkward position. I need to deliver the goods and I don't even know where to start. I need a program which connects to a webpage and gets that page. No fancyness involved.
Is there someone out there who can give me bullet points on what to do?
I am in a fairly awkward position. I need to deliver the goods and I don't even know where to start. I need a program which connects to a webpage and gets that page. No fancyness involved.
Is there someone out there who can give me bullet points on what to do?
Connect to the server with a simple blocking socket. Send a simple
"GET /page.html HTTP/1.1\r\n\r\n" , and then start reading. You'll get a bunch of one-line headers , and then a 2x CRLF - and the document contents after the second CRLF. Most servers will close the connection, so you needn't parse those headers (Content-Length: xxx).
"GET /page.html HTTP/1.1\r\n\r\n" , and then start reading. You'll get a bunch of one-line headers , and then a 2x CRLF - and the document contents after the second CRLF. Most servers will close the connection, so you needn't parse those headers (Content-Length: xxx).
Is there someone out there who can give me bullet points on what to do?
not only that, a ready made program :)
.686
.model flat,stdcall
option casemap:none
include libc.inc
include windows.inc
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
include wininet.inc
includelib wininet.lib
.code
main proc C uses esi edi ebx argc:dword,argv:ptr dword
LOCAL hSession,hUrl,nbr
LOCAL buff[1000h]:byte
invoke InternetOpen,T('Mozilla/4.0'),INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0
mov hSession,eax
invoke InternetOpenUrl,hSession,T("http://www.asmcommunity.net/board/index.php?topic=26036.0;topicseen"),0,0,INTERNET_FLAG_RELOAD,0
mov hUrl,eax
.if eax
.while TRUE
invoke memset,addr buff,0,sizeof buff
invoke InternetReadFile,hUrl,addr buff,(sizeof buff)-1,addr nbr
.break .if eax!=TRUE || nbr==0
invoke strstr,addr buff,T("View the profile of JimmyClif")
.if eax
invoke strstr,eax,T('Posts: ')
.if eax
lea edi,
invoke strtok,eax,T('<')
invoke printf,T('JimmyCliff has %s posts'),edi
.endif
.endif
.endw
.else
invoke printf,T('unable to connect!')
invoke InternetCloseHandle,hSession
return 1
.endif
invoke InternetCloseHandle,hUrl
invoke InternetCloseHandle,hSession
invoke getchar
return 0
main endp
end
Ultrano, actually the header Host in HTTP/1.1 is mandatory so the minimal string is "GET / HTTP/1.1\r\nHost:www.asmcommunity.net\r\n\r\n". If the requested object is cacheable either explicitly or implicitly, is recommended to send "Cache-Control: no-cache" as well, otherwise, proxies like NetCache will kindly offer you a stale copy without any minimal attempt to verify if the cache copy is obsolete. At least that is the way NetCache behaves on my ISP due to the abuse of the heuristic expiration when header Last-Modified is present but none of the explicit expiration headers are sent.
I'd suggest you look into http://curl.haxx.se/ - it's easy to use, and it works and is stable.
Thank you all :thumbsup: The help is very very appreciated!!!
Drizz,
You are the man! I tried it at work and it worked. At home, I had to replace INTERNET_OPEN_TYPE_PRECONFIG with INTERNET_OPEN_TYPE_DIRECT for it to work.
Thank you very much.
PS: Please noone think that this is typical for my work ethic. I promised a little tool for a friend of mine during a weekend pub crawl and forgot all about it. :oops:
You are the man! I tried it at work and it worked. At home, I had to replace INTERNET_OPEN_TYPE_PRECONFIG with INTERNET_OPEN_TYPE_DIRECT for it to work.
Thank you very much.
PS: Please noone think that this is typical for my work ethic. I promised a little tool for a friend of mine during a weekend pub crawl and forgot all about it. :oops:
Is there someone out there who can give me bullet points on what to do?
not only that, a ready made program :)
.686
.model flat,stdcall
option casemap:none
include libc.inc
include windows.inc
include kernel32.inc
includelib kernel32.lib
include user32.inc
Thanks Drizz.
I don't have the libc.inc file.
Where can I find it.
Thanks.
I don't have the libc.inc file.
Where can I find it.
Where can I find it.
you can find it in this attachment http://www.asmcommunity.net/board/index.php?action=dlattach;topic=22278.0;attach=1189 or on my homepage
resolved...