Sign in to follow this  
Followers 0
i3illig

tcp functions with https

1 post in this topic

#1 ·  Posted (edited)

Hey everyone!

I want to write a TCP connecting to a https Server...

But I don't know how to convert the "plain http header" to a "https" one...

In the following example I try to connect to a https login page on port 443 with a http(!) header:

TCPStartup()

$IP = "80.239.186.40"
$Socket = TCPConnect($IP,443) ; 443 = https

$Header = "GET /login/login.xml?ref=https%3A%2F%2Fwww.wow-europe.com%2Faccount%2F&app=wam HTTP/1.0" & @CRLF & _
"Connection: close" & @CRLF & _
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" & @CRLF & _
"Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7" & @CRLF & _
"Cache-Control: no" & @CRLF & _
"Accept-Language: de,en;q=0.7,en-us;q=0.3" & @CRLF & @CRLF

$Send = TCPSend($Socket,$Header)

    While 1
        $Recv = TCPRecv($Socket, 1024)
        If $Recv <> '' Then
            While 1
                $Recv &= TCPRecv($Socket, 1024)
                If @error Then ExitLoop 2
            WEnd
        EndIf
    WEnd
    
MsgBox(0,"",$Recv)

And here comes the error Message :P

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<html><head>

<title>400 Bad Request</title>

</head><body>

<h1>Bad Request</h1>

<p>Your browser sent a request that this server could not understand.<br />

Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />

Instead use the HTTPS scheme to access this URL, please.<br />

<blockquote>Hint: <a href="https://ew1-web-13-http04.wowadmin.net/"><b>https://ew1-web-13-http04.wowadmin.net/</b></a></blockquote></p>

</body></html>

Maybe there is a UDF out to convert the header??

greetings i3illig

// EDIT:

It should look like THIS

Edited by i3illig

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