Sign in to follow this  
Followers 0
autoitxp

TCPRecv Html code How to Browse it

8 posts in this topic

Hi

i successfully received Html source code through TCPRecv to connected socket now

how i can i tcprecv html data broadcast through webbrowser etc IE ? help !

Share this post


Link to post
Share on other sites



Hi

i successfully received Html source code through TCPRecv to connected socket now

how i can i tcprecv html data broadcast through webbrowser etc IE ? help !

Use the IE.au3 UDF to open IE and then set the HTML to what you received with _IEBodyWriteHTML().

If that's not what you meant, rewrite that question in English or post it in you native language so we can get a better translation.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi here is my full code but it showz nothing _IEBodyWriteHTML returned blank

#include <GUIConstants.au3>
#include <IE.au3>
TCPStartUp()


Dim $ConnectedSocket = -1
$ConnectedSocket = TCPConnect("192.168.12",80)

If @error Then
    MsgBox(4112,"Error","TCPConnect failed with WSA error: " & @error)
Else
    
    
$sReq  = "GET/ HTTP/1.0" & @CRLF & @CRLF
ConsoleWrite("Sent Request:" & @CRLF & $sReq & @CRLF)
TCPSend($ConnectedSocket,$sReq)


$sRepy = ""
While 1
    $sBuff = TCPRecv($ConnectedSocket,1024*5)
    If @error Then ExitLoop
    If StringLen($sBuff) > 0 Then
        $sRepy &= $sBuff
    
    EndIf
    Sleep(100)
WEnd

;ConsoleWrite($sRepy )

$iHeadEnd = StringInStr($sRepy,@CRLF & @CRLF) +2
$sRepyHead = StringMid($sRepy,1,$iHeadEnd)
$sRepyBody = StringMid($sRepy,$iHeadEnd)
MsgBox(64, "" , $sRepyHead)



$oIE = _IECreate ("about:blank")
_IEBodyWriteHTML ($oIE, $sRepy)

EndIf
Edited by autoitxp

Share this post


Link to post
Share on other sites

Hi here is my full code but it showz nothing _IEBodyWriteHTML returned blank

_IEBodyWriteHTML only returns -1 or 0. You are looking for visual presentation of the page, right?

Did $reply contain valid HTML when you did _IEBodyWriteHTML($oIE, $reply)?

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Hi

well ip is 192.168.1.12:80 and its correct

yah i need visual presentation of page

when $reply retrieve redirect page html source code then _IEBodyWriteHTML ended with error

$o_object.document.body.innerHTML = $s_html

$o_object.document.body.innerHTML = $s_html^ ERROR

Like

<html><head><!-- www.freedomain.co.nr -->
<title>Google.com</title>
<script language="Javascript">
if(top.frames.length > 0)
top.location.href=self.location;
</script>
</head>
<frameset rows="100%,*" frameborder="NO" border="0" framespacing="0">
<frame name="conr_main_frame" src="http://google.com">
</frameset>
<noframes>
<body>
<div align=center>
<h1>Google.com</h1>
<p><b>site contains official content .</b></p>
<p>Please <a href="http://google.com">Click here</a> to visit <a href="http://google.com/"><b>Google.com</b></a></p><br><br>
<p>Powered by <a href="http://www.freedomain.co.nr/"><b>Free Domain Name</b></a> - <a href="http://www.freedomain.co.nr/"><b>Free URL Redirection</b></a> and <a href="http://www.freedomain.co.nr/"><b>Free Subdomain</b></a> @ .CO.NR</p>
</div>
</body>
</noframes>
</html>

Share this post


Link to post
Share on other sites

I think you should use _IEDocWriteHTML not _IEBodyWriteHTML


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

I think you should use _IEDocWriteHTML not _IEBodyWriteHTML

Doh! :D

Yeah, that should have been:

_IEDocWriteHTML($oIE, $reply)
_IEAction ($oIE, "refresh")

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi

I think I got Main problem here it is

While 1
    $sBuff = TCPRecv($ConnectedSocket,1024*5)
    If @error Then ExitLoop
    If StringLen($sBuff) > 0 Then
        $sRepy &= $sBuff
EndIf
    Sleep(100)
WEnd

TCPSend($ConnectedSocket, $sRepy)

$sRepy need to send data again via Tcpsend to connected socket until TcpRecv stop sending Request

coz when i send $sRepy data to socket it received new html source Code

How to get data until it complety Received ?

Edited by autoitxp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0