|
You last visited: Today at 04:02
Advertisement
Help with winhttp
Discussion on Help with winhttp within the AutoIt forum part of the Coders Den category.
09/21/2011, 19:47
|
#1
|
elite*gold: 0
Join Date: Sep 2010
Posts: 8
Received Thanks: 0
|
Help with winhttp
Hi there,
I'm trying to learn winhttp functions from winhttp udf.
I would like to automate facebook forms with it. but i don't know how to get fb forms info for headers and etc. does anyone here knows a good documentation or even better a working example code for fb?
-Note: i've tried wireshark but it doesnt support my network interface.
|
|
|
09/21/2011, 19:52
|
#2
|
elite*gold: 52
Join Date: Oct 2010
Posts: 1,998
Received Thanks: 389
|
Try the AddOn LiveHTTP headers for Firefox.
|
|
|
09/21/2011, 20:30
|
#3
|
elite*gold: 0
Join Date: Sep 2010
Posts: 8
Received Thanks: 0
|
Quote:
Originally Posted by BlackHybrid
Try the AddOn LiveHTTP headers for Firefox.
|
Hi, thank you for your help. I'm testing it right now.
Do you or anyone has live example code for, lets say update a post on fb profile with winhttp? it would be amazing to take a peek at it
|
|
|
09/21/2011, 20:38
|
#4
|
elite*gold: 52
Join Date: Oct 2010
Posts: 1,998
Received Thanks: 389
|
I can suggest you to do it with TCP.
My first steps with winhttp failed and i dont know how.
With the same packet and TCP it worked.
You can read the TuT from Shadow992
|
|
|
09/21/2011, 21:22
|
#5
|
elite*gold: 0
Join Date: Sep 2010
Posts: 8
Received Thanks: 0
|
only if i knew german 
but thanks anyways. i didn't know it could be done by tcp. and it IS seems like a little easier.
Sorry to bother you any good tuts in english like this?
if not i will check google anyways.
thx a lot.
|
|
|
09/21/2011, 21:54
|
#6
|
elite*gold: 52
Join Date: Oct 2010
Posts: 1,998
Received Thanks: 389
|
I think if you watch at these funktions and know a bit how it woks with packets you schould understand it.
You just try to rebuild the packet. If you got a GET packet set the parameter $sPost to a empty string. You also need to get the cookies. When you send the first GET packet you should get the cookies. They are in the source, the return of TCPRequest. You get the cookies by using the GetCookies funktion. From now you need to set the cookies in TCPRequest.
Just try it a bit and show the return in a MsgBox to see if you created a packet succesfull.
PHP Code:
#include<String.au3>
Func GetCookies($sQuellcode) Local $sCookies, $i, $aCookies $sCookies = '' $aCookies = _StringBetween($sQuellcode, 'Set-Cookie: ', ';', 1) For $i = 0 To UBound($aCookies) - 1 $sCookies &= $aCookies[$i] & ';' Next Return $sCookies EndFunc ;==>GetCookies
Func TCPRequest($sIp, $sHost,$msg=0, $sSeite = "", $sPost = '', $sCookies = '', $sReferer = '', $iMaxTime = 10000) Local $sPacket, $iSocket, $iTimer
If $sPost = '' Then $sPacket = 'GET /' & $sSeite & ' HTTP/1.1' & @CRLF Else $sPacket = 'POST /' & $sSeite & ' HTTP/1.1' & @CRLF EndIf $sPacket &= 'Host: ' & $sHost & @CRLF & _ 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)' & @CRLF & _ 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' & @CRLF & _ 'Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3' & @CRLF & _ 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' & @CRLF & _ 'Keep-Alive: 300' & @CRLF & _ 'Content-Type: application/x-www-form-urlencoded' & @CRLF & _ 'Connection: keep-alive' & @CRLF If $sReferer <> '' Then $sPacket &= 'Referer: ' & $sReferer & @CRLF EndIf If $sCookies <> '' Then $sCookies=StringStripCR($sCookies) $sCookies=StringStripWS($sCookies,8) $sPacket &= 'Cookie: ' & $sCookies & @CRLF EndIf If $sPost <> '' Then $sPacket &= 'Content-Length: ' & StringLen($sPost) & @CRLF EndIf $sPacket &= @CRLF If $sPost <> '' Then $sPacket &= $sPost EndIf If $msg=1 Then MsgBox(0,"Packet",$sPacket) EndIf TCPStartup() If @error Then Return SetError(1, 0, "") $iSocket = TCPConnect($sIp, 80) If @error Then Return SetError(2, 0, "") TCPSend($iSocket, $sPacket) If @error Then Return SetError(3, 0, "") $iTimer = TimerInit() Do $sRecv = TCPRecv($iSocket, 1024) If TimerDiff($iTimer) > $iMaxTime Then Return SetError(4, 0, "") Until $sRecv <> "" Do $sRecv &= TCPRecv($iSocket, 1024) Until @error Or StringInStr($sRecv, '</html>') TCPCloseSocket($iSocket) TCPShutdown() Return $sRecv EndFunc ;==>TCPRequest
Func Change($string) $string = StringReplace($string, "%", "%25") $string = StringReplace($string, "†", "%E2%80%A0") $string = StringReplace($string, "ä", "%C3%A4") $string = StringReplace($string, "ö", "%C3%B6") $string = StringReplace($string, "ü", "%C3%BC") $string = StringReplace($string, "!", "%21") $string = StringReplace($string, '"', "%22") $string = StringReplace($string, "§", "%C2%A7") $string = StringReplace($string, "$", "%24") $string = StringReplace($string, "&", "%26") $string = StringReplace($string, "/", "%2F") $string = StringReplace($string, "+", "%2B") $string = StringReplace($string, " ", "+") $string = StringReplace($string, "(", "%28") $string = StringReplace($string, ")", "%29") $string = StringReplace($string, "=", "%3D") $string = StringReplace($string, "?", "%3F") $string = StringReplace($string, "[", "%5B") $string = StringReplace($string, "]", "%5D") $string = StringReplace($string, "{", "%7B") $string = StringReplace($string, "}", "%7D") $string = StringReplace($string, "ß", "%C3%9F") $string = StringReplace($string, ",", "%2C") $string = StringReplace($string, ":", "%3A") $string = StringReplace($string, ";", "%3B") $string = StringReplace($string, "#", "%23") $string = StringReplace($string, "~", "%7E") $string = StringReplace($string, "²", "%C2%B2") $string = StringReplace($string, "³", "%C2%B3") $string = StringReplace($string, "<", "%3C") $string = StringReplace($string, ">", "%3E") $string = StringReplace($string, "|", "%7C") $string = StringReplace($string, "^", "%5E") $string = StringReplace($string, "°", "%C2%B0") $string = StringReplace($string, "´", "%C2%B4") $string = StringReplace($string, "@", "%40") $string = StringReplace($string, "€", "%E2%82%AC") Return $string EndFunc ;==>Change
|
|
|
 |
Similar Threads
|
WinHTTP Proxy Problem
10/30/2011 - AutoIt - 8 Replies
Hallo com,
habe folgendes Problem bei der Proxy Einstellung mit WinHTTP.
Mein Code sieht wie folgt aus:
#include <WinHTTP.au3>
#include <String.au3>
#include <Array.au3>
$Proxy = "59.66.63.182:8909"
|
Youtube Login mit WinHTTP - was mach ich falsch ?
08/03/2011 - AutoIt - 2 Replies
Hallo Leute,
Und zwar geht es darum das ich mich gerne mit WinHttp bei Youtube einloggen möchte, um dann meine Nachrichten dort abrufen zu können.
Jedoch scheitere ich bereits bei dem Login zu Youtube, welcher wohl etwas komplizierter erscheint.
Zu aller erst bin ich auf YouTube - Broadcast Yourself gegangen, dort dann auf "Anmelden".
Nun habe ich mit Live Http Headers vom Firefox angefangen mitzuschneiden, als ich auf den Loginbutton gedrückt habe.
...
|
[Frage] Winhttp
11/14/2010 - AutoIt - 1 Replies
Ich wollte mich ein wenig mit Winhttp vertraut machen und habe mir ein Tutorial durchgelesen......
Das hier soll eine einlogg funktion sein.... nur ich krieger immer nur diese Fehlermeldung......:
Wenn ich das Script starte passiert ..nichts... auser das ich halt diese Fehlermeldung in die Zwischenablage bekomme...
Ich hoffe ihr könnt mir helfen :)
Das Spiel heist Die-Staemme
Source vom Script :
|
WINHTTP.dLL
07/02/2006 - Technical Support - 2 Replies
Hilfe Ich da ich heute Formatiert habe und alles neu drauf laden musste usw..... hab ich nun ein neues problem MSN will nicht Starten begründung winHTTP.dll wurde nicht gefunden!
|
All times are GMT +1. The time now is 04:02.
|
|