Question

I'm sending some data from my application to a php file which may print 3 different things on the screen (if I would open it in my browser), I'm sending something to my URL like so:

sendtourl PROC

_loop:

    invoke lstrcpy,addr _urlTmp ,addr _url   
    invoke lstrcat, addr _urlTmp , addr lpszNumber    ;----- add parameter to url
    invoke InternetOpen,addr _agent, 0 ,0,0,0   ;----- specify user agent 
    test eax,eax  
    jz _exit 
    mov [InternetHandle],eax
    invoke InternetOpenUrl, InternetHandle,ADDR  _urlTmp,  0 ,0,0, 0 ;----- open URL
    test eax,eax   
    jz _exit 
    mov [FileHandle],eax   
    invoke InternetReadFile,FileHandle,addr FileBuffer,1023, addr BytesRead  
    test eax,eax   
    jz _exit  
    mov eax,[BytesRead] 
    mov b[FileBuffer+eax],0  
   ; invoke Sleep,600000   
    invoke InternetCloseHandle,  [FileHandle]  
    invoke InternetCloseHandle,  [InternetHandle]

    ret

_exit:

    invoke InternetCloseHandle,[FileHandle]    
    invoke InternetCloseHandle,[InternetHandle]    
    ;;invoke ExitProcess,0

;----- 

    ret

sendtourl ENDP

Now there may be 1 of 3 things printed depending on what was sent to the url: yes, no, maybe

Is it possible to take this output and put it back in some variable in my application so I may reuse it, for example:

  • Output was yes = do nothing
  • Output was no = close application
  • Output was maybe = do something else

The sending part works fine, I just can't figure out how can I get the response ?

Was it helpful?

Solution

The response from the web page should be in FileBuffer. As it is text, you will have to parse the response content in the buffer, skipping over the response header, and isolate out the text that you are looking for, then compare it to the ASCII character values to determine what it is (or use a string/character comparison function from one of the MASM libraries).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top