Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 20:18

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



WinHTTP.au3 und EPVPIMG.com

Discussion on WinHTTP.au3 und EPVPIMG.com within the AutoIt forum part of the Coders Den category.

Closed Thread
 
Old   #1
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
WinHTTP.au3 und EPVPIMG.com

Hi epvp!
Ich möchte mit der WinHTTP.au3 ein Bild auf hochladen
Ist das möglich?

LiveHTTPHeaders:
Code:
http://epvpimg.com/upload/

POST /upload/ HTTP/1.1
Host: epvpimg.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
X-Requested-With: XMLHttpRequest
Referer: http://epvpimg.com/
Content-Length: 795
Content-Type: multipart/form-data; boundary=---------------------------27131995127988
Cookie: __cfduid=d3fff16db3429b3f025f1ddb3e7dfa15a1335200540; __utma=195115128.1251829787.1335200712.1335200712.1335200712.1; __utmb=195115128.2.10.1335200712; __utmc=195115128; __utmz=195115128.1335200712.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Pragma: no-cache
Cache-Control: no-cache
-----------------------------27131995127988
Content-Disposition: form-data; name="files[]"; filename="favicon.gif"
Content-Type: image/gif

GIF89a  Æy 0<t/>w/?w%G’&H)H‡)I‡"L—)L‰(MŠ+M„+M‡*O‡+O‡)P‰*Pˆ(Q‹*Qˆ(QŽ)QŒ)R‡%R“&SŽ%S“%T“(TŒ&U(UŽ%V–"Wš(W‹%X’"Z™%Z•(ZŽ [Ÿ!\œ \Ÿ\¦)\‰]¤%^–&_“ `*&dgºf¨g¸h§i§j½	oÌm¦n*pÈ p*qºr¿rÎr*	tÕv± yáwé yèyÑ yð zç {ëy±{â{Ñ |èz¶z¸ }ù}Û~ß €ì ÷ €ï €ñ ðè þƒä‚ø‚ú …î „ø …ú …û†ò‡ê ˆÿ‰ù‹ú ‹ÿ ŒøŒø Œÿ ï ‘ë ÿ ‘ü‘Ç ‘ÿ “ÿ ”ÿ–ñ–Ý œÿ	¥ß «ÿ¯î±ö ²ÿ´û ·ÿ ¸ÿ ¼ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ!þCreated with GIMP !ù
  ,       ¢€‚ƒ„…†‡†1=	E0‚I5nt6ixM;J”4vl%_gmqW7wo&)]d`clV,uk?+ba\ L'sjO#‚
8a^S "rjT/
„GZ[<*phK:†!UQDfeBF‡.XHC@NP<@Ô ‡PZ4@$hC,3&0$„Œ	U˘1 ;
-----------------------------27131995127988--

HTTP/1.1 200 OK
Server: cloudflare-nginx
Date: Mon, 23 Apr 2012 17:06:17 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate
Content-Disposition: inline; filename="files.json"
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size
Vary: Accept
Content-Encoding: gzip
----------------------------------------------------------
http://epvpimg.com/img/glyphicons-halflings.png

GET /img/glyphicons-halflings.png HTTP/1.1
Host: epvpimg.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://epvpimg.com/css/bootstrap.min.css
Cookie: __cfduid=d3fff16db3429b3f025f1ddb3e7dfa15a1335200540; __utma=195115128.1251829787.1335200712.1335200712.1335200712.1; __utmb=195115128.2.10.1335200712; __utmc=195115128; __utmz=195115128.1335200712.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
If-Modified-Since: Fri, 09 Mar 2012 15:04:14 GMT
If-None-Match: "80877-1100-4bad0b4ac5780"
Cache-Control: max-age=0

HTTP/1.1 304 Not Modified
Server: cloudflare-nginx
Date: Mon, 23 Apr 2012 17:06:17 GMT
Connection: keep-alive
Last-Modified: Fri, 09 Mar 2012 15:04:14 GMT
Etag: "80877-1100-4bad0b4ac5780"
CF-Cache-Status: HIT
Vary: Accept-Encoding
Expires: Mon, 23 Apr 2012 21:06:17 GMT
Cache-Control: public, max-age=14400
----------------------------------------------------------
http://i.epvpimg.com/pHvQc.gif

GET /pHvQc.gif HTTP/1.1
Host: i.epvpimg.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Referer: http://epvpimg.com/
Cookie: __cfduid=d3fff16db3429b3f025f1ddb3e7dfa15a1335200540; __utma=195115128.1251829787.1335200712.1335200712.1335200712.1; __utmb=195115128.2.10.1335200712; __utmc=195115128; __utmz=195115128.1335200712.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)

HTTP/1.1 200 OK
Server: cloudflare-nginx
Date: Mon, 23 Apr 2012 17:06:17 GMT
Content-Type: image/gif
Content-Length: 602
Connection: keep-alive
CF-Cache-Status: MISS
Vary: Accept-Encoding
Expires: Mon, 23 Apr 2012 21:06:17 GMT
Cache-Control: public, max-age=14400
----------------------------------------------------------
Mein Code:
Code:
#include <WinHTTP.au3>
#include <Array.au3>

Opt('MustDeclareVars',1)
_EPVPIMG(FileRead(@ScriptDir&'\favicon.gif'))

Func _EPVPIMG($vImage)
local $hSession =_WinHttpOpen('')
local $hConnect=_WinHttpConnect($hSession,'epvpimg.com')
local $asReturn=_WinHttpSimpleRequest($hConnect,'POST','/upload/','','-----------------------------27131995127988'&@CRLF& _
'Content-Disposition: form-data; name="files[]"; filename="favicon.gif"'&@CRLF& _
'Content-Type: image/gif'&@CRLF&@CRLF&$vImage&@crlf& _
'-----------------------------27131995127988','',True)
_ArrayDisplay($asReturn)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hSession)
EndFunc
Das Array gibt das hier zurück: [1]|[{"error":"File is too big"}]

MfG
Achat is offline  
Old 04/23/2012, 20:06   #2


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
Auf alle fälle musst du noch dein Boundary erzeugen
Code:
Func getBoundary() 
return Stringleft(_TimeGetStamp()*random(10,256,1), 16) 
EndFunc 


Func _TimeGetStamp() 
Local $av_Time 
$av_Time = DllCall('CrtDll.dll', 'long:cdecl', 'time', 'ptr', 0) 
If @error Then 
SetError(99) 
Return False 
EndIf 
Return $av_Time[0] 
EndFunc
Lawliet is offline  
Old 04/23/2012, 20:21   #3
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
Danke für deine Antwort.
Aber wie kann ich deine Funktionen in meinem Script verwenden?
Könntest du sie bitte etwas genauer erklären?
Danke.
Achat is offline  
Old 04/23/2012, 20:43   #4


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
Statt
Code:
'-----------------------------27131995127988'
musst du eben
Code:
'-----------------------------' & getBoundary
mitsenden
Edit:
Hier nochmal wie das Packet aussehen müsste:

Code:
$packet = 'http://epvpimg.com/upload/' & @crlf  & @crlf & _
'POST /upload/ HTTP/1.1' & @crlf & _
'Host: epvpimg.com' & @crlf & _
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101' & @crlf & _ 'Firefox/11.0' & @crlf & _
'Accept: application/json, text/javascript, */*; q=0.01' & @crlf & _
'Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3' & @crlf & _
'Accept-Encoding: gzip, deflate' & @crlf & _
'Connection: keep-alive' & @crlf & _
'X-Requested-With: XMLHttpRequest' & @crlf & _
'Referer: http://epvpimg.com/' & @crlf & _
'Content-Length: 795' & @crlf & _
'Content-Type: multipart/form-data; boundary=---------------------------' & getboundary()  & @crlf & _
'Cookie: __cfduid=d3fff16db3429b3f025f1ddb3e7dfa15a1335200540; __utma=195115128.1251829787.1335200712.1335200712.1335200712.1; __utmb=195115128.2.10.1335200712; __utmc=195115128; __utmz=195115128.1335200712.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)' & @crlf & _
'Pragma: no-cache' & @crlf & _
'Cache-Control: no-cache' & @crlf & _
-----------------------------'& getboundary() & @crlf & _
'Content-Disposition: form-data; name="files[]"; filename=' & '"' & $imagename & '"' & _
Content-Type: image/gif
$Image & @crlf & _
'-----------------------------'& getboundary() & '--'
Lawliet is offline  
Thanks
1 User
Old 04/23/2012, 21:36   #5
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403


Da ist wohl ein Fehler aufgetreten
Habe Win7 64bit SP1.
Was jetzt? Kann dieses "boundary" noch anders erzeugt werden?
Achat is offline  
Old 04/23/2012, 22:27   #6
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
Code:
$stamp = TimerInit()
ConsoleWrite($stamp&@CRLF)
lolkop is offline  
Thanks
1 User
Old 04/24/2012, 14:13   #7
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
Code:
_EPVPIMG(FileRead(@ScriptDir & '\favicon.gif'))

Func _EPVPIMG($vImage)
	local $hTimer=TimerInit()
	Local $iBoundary = StringLeft($hTimer * Random(10, 256, 1), 16)
	Local $hSession = _WinHttpOpen('')
	Local $hConnect = _WinHttpConnect($hSession, 'epvpimg.com')
	Local $asReturn = _WinHttpSimpleRequest($hConnect, 'GET', '')
	Local $asReturn = _WinHttpSimpleRequest($hConnect, 'POST', '/upload/', '', '-----------------------------' & $iBoundary & @CRLF & _
			'Content-Disposition: form-data; name="files[]"; filename="favicon.gif"' & @CRLF & _
			'Content-Type: image/gif' & @CRLF & @CRLF & $vImage & @CRLF & _
			'-----------------------------' & $iBoundary & '--', '', True)
	_ArrayDisplay($asReturn)
	_WinHttpCloseHandle($hConnect)
	_WinHttpCloseHandle($hSession)
EndFunc   ;==>_EPVPIMG
Funktioniert nicht. Hat jemand eine Idee?

Das Array gibt zurück:
Code:
[0]|HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Connection: keep-alive
Date: Tue, 24 Apr 2012 12:26:05 GMT
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/plain
Server: cloudflare-nginx
Vary: Accept,Accept-Encoding
Content-Disposition: inline; filename="files.json"
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size


[1]|[{"error":"File is too big"}]
Achat is offline  
Old 05/02/2012, 15:44   #8
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
So, ich bekomme jetzt keinen Error mehr

Mein Script:

Aber ich bekomme auch keinen Link zum Bild zurück, sondern das hier:


Hat jemand eine Idee, woran das liegt?

MfG
Achat is offline  
Old 05/02/2012, 21:29   #9


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
Einfach beim testen immer
Code:
$html = _winhttpsiplerequest(blablabla)
Filedelete(@desktopdir & "\test.html")
Filewrite(@desktopdir & "\test.html")
shellexecute(@desktopdir & "\test.html")
Dann wüsstest du jetzt, dass folgendes zurück gegeben wird:
Quote:
Image not found. Please continue to our home site.

E: oh hast du ja, sry
Lawliet is offline  
Old 04/05/2013, 12:20   #10
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
Ich hab es jetzt mal mit versucht:

Code:
#include <Date.au3>
_EpvpImg(@ScriptDir & '\logo.png')
Func _EpvpImg($sImage)
	Local $iBoundary = _GetBoundary()
	$sSend = '-----------------------------' & $iBoundary & @CRLF & _
			'Content-Disposition: form-data; name="files[]"; filename="logo.png"' & @CRLF & _
			'Content-Type: image/png' & @CRLF & _
			'' & @CRLF & _
			FileRead($sImage) & @CRLF & _
			'-----------------------------' & $iBoundary & '--'
	ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sSend = ' & $sSend & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
	$oXML = ObjCreate('Microsoft.XMLHTTP')
	$oXML.Open('POST', 'http://epvpimg.com/upload/', False)
	$oXML.setRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0')
	$oXML.setRequestHeader('Accept', 'application/json, text/javascript, */*; q=0.01')
	$oXML.setRequestHeader('Accept-Language', 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3')
	$oXML.setRequestHeader('Accept-Encoding', 'gzip, deflate')
	$oXML.setRequestHeader('X-Requested-With', 'XMLHttpRequest')
	$oXML.setRequestHeader('Referer', 'http://epvpimg.com/')
	$oXML.setRequestHeader('Content-Length', StringLen(FileRead($sImage)))
	$oXML.setRequestHeader('Content-Type', 'multipart/form-data; boundary=---------------------------' & $iBoundary)
	$oXML.setRequestHeader('DNT', '1')
	$oXML.setRequestHeader('Connection', 'keep-alive')
	$oXML.setRequestHeader('Pragma', 'no-cache')
	$oXML.setRequestHeader('Cache-Control', 'no-cache')
	$oXML.Send($sSend)
	ConsoleWrite($oXML.status & ' ' & $oXML.statustext & @CRLF & $oXML.getAllResponseHeaders & @CRLF)
	ConsoleWrite($oXML.responsetext & @CRLF)
EndFunc   ;==>_EpvpImg

Func _GetBoundary()
	$vReturn = _Date_Time_GetSystemTime()
	$vReturn = StringReplace(StringReplace(StringReplace(_Date_Time_SystemTimeToDateTimeStr($vReturn), '/', ''), ':', ''), ' ', '')
	Return StringLeft($vReturn * Random(10, 256, 1), 16)
EndFunc   ;==>_GetBoundary
Fehler

Was mache ich falsch?

€: Ich hab das Packet genau wie in Firebug/LiveHttpHeaders nachgebaut, es geht aber nicht :'<

€2: Ich bitte um Hilfe. Danke.

MfG
Achat is offline  
Old 04/06/2013, 16:05   #11
 
Achat's Avatar
 
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403


Ich kann jetzt auf epvpimg.com uploaden. <33333333333333333333333
UDF werde ich später releasen.
#closerequest

MfG
Achat is offline  
Old 04/06/2013, 20:08   #12


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
#closed
Lawliet is offline  
Thanks
1 User
Closed Thread

Tags
autoit, bilder, epvpimg, hochladen, winhttp


Similar Threads Similar Threads
Bilder von epvpimg im Forum einfügen
04/09/2012 - Main - 7 Replies
Hallo, Irgendwie kann ich Bilder die bei epvpimg geuploadet wurden nicht hier im Forum einfügen. Geht´s euch auch so? Oder mach ich irgendwas falsch? :/ MfG ExChill
[B] EpvpImg - Tool [S] Spende ?
03/12/2012 - Coding Releases - 12 Replies
Hallo Elitepvpers-Commnuity, wie ihr schon alle erfahren habt, bietet Elitepvpers nun einen ImageHoster an. Da dachte ich mir gleich das ich dazu ein Tool schreiben, mit vielen hilfreichen Funktionen. Was dieses Tool bietet: 1. Schnelle speichern von Links (NumPad1) 2. Bilder einfach uploaden 3. Bilder, Url und Namen werden gespeichert und können sofort abgerufen werden. 4. Bilder leicht speichern bzw. downloaden 5. Sehr einfach zu benutzen und übersichtlich.
Help with winhttp
09/21/2011 - AutoIt - 5 Replies
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.
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 20:20.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.