Hi,
ich versuche grade über TCP ein Bild auf Imagebanana hochzuladen. Jedoch hab ich leichte Probleme damit wie das Post-Packet erstellt wird.
Hier einmal das Orginal:
Spoiler anzeigen
POST / HTTP/1.1
Host: www.imagebanana.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www.imagebanana.com/
Cookie: __utma=265537687.1626559516.1273126282.1273126282.1273126282.1; __utmb=265537687.35.10.1273126282; __utmc=265537687; __utmz=265537687.1273126282.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); user_id=**********; password=*************************************
Content-Type: multipart/form-data; boundary=---------------------------193231953297
Content-Length: 42688
-----------------------------193231953297
Content-Disposition: form-data; name="img"; filename="Bild.jpg"
Content-Type: image/jpeg
ÿØÿà
Alles anzeigen
Und nun hab ich versucht das ganze in Autoit nachzubauen:
Spoiler anzeigen
Func _banane_upload($sCookie, $sFile)
$sPost = "-----------------------------18060217183753" & @CRLF & _
'Content-Disposition: form-data; name="img"; filename="Bild.jpg"' & @CRLF & _
"Content-Type: image/jpeg" & @CRLF & _
@CRLF & _
FileRead(FileOpen($sFile)) & @CRLF & _
'-----------------------------18060217183753' & @CRLF & _
'Content-Disposition: form-data; name="send"' & @CRLF & _
@CRLF & _
'Hochladen!' & @CRLF & _
'-----------------------------18060217183753' & @CRLF & _
'Content-Disposition: form-data; name="resize"' & @CRLF & _
@CRLF & _
'320x240' & @CRLF & _
'-----------------------------18060217183753--' & @CRLF & @CRLF
$sHeader = "POST / HTTP/1.1" & @CRLF & _
"Host: http://www.imagebanana.com" & @CRLF & _
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" & @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: 115" & @CRLF & _
"Connection: keep-alive" & @CRLF & _
"Referer: http://www.imagebanana.com/" & @CRLF & _
"Cookie: " & $sCookie & @CRLF & _
"Content-Type: multipart/form-data; boundary=---------------------------193231953297" & @CRLF & _
"Content-Length: " & StringLen($sPost) & @CRLF & @CRLF & $sPost
$iSocket = _banane_startup()
TCPSend($iSocket, $sHeader)
Do
$sRecv = TCPRecv($iSocket, 1)
Until $sRecv <> ""
Do
$sRecv &= TCPRecv($iSocket, 1)
Until @error Or StringInStr($sRecv, "</html>")
FileWrite("upload.html", $sRecv)
_banane_shutdown($iSocket)
EndFunc ;==>_banane_upload
Jedoch wird die Datei nicht vom Server angenommen. Ich denke das liegt an diesen langen zahlen -> 193231953297 die werden immerwieder neu generiert. Nur wie finde ich raus wie sich die Zahl zusammen setzt?
Hier mal den Quelltext der Seite, vielleicht findet ihr ja was interessantes
Spoiler anzeigen
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="verify-v1" content="CTCexsEFXWhe38UKSMQvbtfufUtNrck/EdVbH9qJMZI=" />
<meta name="robots" content="INDEX,FOLLOW" />
<meta name="keywords" content="bilder hochladen, image upload, bilder upload, image hosting, fotos, foto upload, imagebanana, image banana,SNIT" />
<meta name="description" content="Imagebanana - image upload" />
<link rel="shortcut icon" href="http://www.imagebanana.com/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="http://www.imagebanana.com/sites/css/style.css" />
<script type="text/javascript" src="http://www.imagebanana.com/sites/js/LoadVars.js"></script>
<script type="text/javascript" src="http://www.imagebanana.com/sites/js/BytesUploaded.js"></script>
<script type="text/javascript">
var bUploaded = new BytesUploaded('http://www.imagebanana.com/upload/ajaxupload.php');
</script>
<script language="JavaScript">
<!--
function start_upload() {
document.getElementById('contentuploadbox').style.display = 'none';
document.getElementById('contentuploadbox').style.visible = 'hidden';
document.getElementById('loading').style.display = 'block';
/*document.getElementById('uploadbox').style.background = 'url(http://www.imagebanana.com/imgs/upload_bg2.png)';*/
}
var abbrechennow=1;
function abbrechen () {
abbrechennow = abbrechennow - 0.1;
document.getElementById('overlay').style.opacity = abbrechennow;
if ( abbrechennow > 0.2 ) {
setTimeout('abbrechen()' , 1);
} else {
document.getElementById('loading').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
top.location.href='http://www.imagebanana.com/';
}
}
-->
</script> <script type="text/javascript" src="http://www.imagebanana.com/sites/js/AC_OETags.js"></script>
<title>ImageBanana</title>
</head>
<body>
<div id="userloggedin"><img src="http://www.imagebanana.com/imgs/symbols/userloggedin.png" /> <a href="http://www.imagebanana.com/myib/">monkey666</a> ist <b>eingeloggt</b>.<br /></div><!-- Links -->
<div id="toplinks"><p>
<a href="http://www.imagebanana.com/">Home</a>
<span>-</span>
<a href="http://www.imagebanana.com/myib/">Mein ImageBanana</a>
<span>-</span>
<a href="http://www.imagebanana.com/faqs/">FAQ</a>
<span>-</span>
<a href="http://www.imagebanana.com/regeln/">Regeln</a>
<span>-</span>
<a href="http://blog.imagebanana.com/">Blog</a>
<span>-</span>
<a href="http://www.imagebanana.com/partner/">Partner</a>
<span>-</span>
<a href="http://www.imagebanana.com/feedback/"><img src="http://www.imagebanana.com/imgs/symbols/feedback.gif" border="0" /> Feedback</a>
<span>-</span>
<a target="_blank" href="http://twitter.com/imagebanana"><img src="http://www.imagebanana.com/imgs/symbols/twitter.png" border="0" /> Twitter!</a>
</div></p>
<a href="http://www.imagebanana.com/"><img src="http://www.imagebanana.com/imgs/logo.png" alt="ImageBanana" style="border:0px;"></a><br /><!-- Upload -->
<a name=upload></a><form style="margin:0px; padding:0px;" action="http://www.imagebanana.com/" method="post" enctype="multipart/form-data" onsubmit="start_upload(); ">
<div style="width:700px; margin:auto;"><div id="uploadbox_left"></div> <div id="uploadbox" style="background-image:url('http://www.imagebanana.com/imgs/upload_bg.png');">
<div id="loading">
<!--<a href="#" onclick="abbrechen();">Abbrechen</a>-->
<table style="margin:auto;"><tr><td><img src="http://www.imagebanana.com/imgs/loading.gif"> </td><td><div id="fileprogress">Upload wird gestartet...</div></td></tr></table>
</div>
<div id="contentuploadbox"> <input type="file" name="img" size="25" class="file" /> <input type="submit" name="send" value="Hochladen!" class="input_button" />
</div> </div>
<div id="uploadbox_right"><a href="http://www.imagebanana.com/remoteupload/"> » Remote Upload</a></div></div><div style="clear:left;"></div><!-- Upload Infos -->
<p style="margin:0px;">Erlaubte Bild-Dateien:<br />
<b>jpeg, jpg, gif, png, tif, tiff, bmp, psd, nfo, txt</b><br />
Max. <b>3,50 MB</b><br /><br />
Erlaubte Archiv-Dateien:<br />
<b>tar, 7zip, zip, bzip2</b><br />
Max. <b>25,00 MB</b><br /><br />
<!-- Options -->
<input type="checkbox" id="check_thumbnail" name="check_thumbnail" class="checkbox" /> <label for="check_thumbnail">Entferne Info-Balken im Thumbnail</label><br/>
<input type="checkbox" id="check_resize" name="check_resize" class="checkbox"/> <label for="check_resize">Bildgröße ändern:</label>
<select name="resize">
<option value="80x80">80x80 ( small Avatar )</option>
<option value="100x75">100x75 ( Avatar )</option>
<option value="100x100">100x100 ( Avatar )</option>
<option value="150x112">150x112 ( Thumbnail )</option>
<option value="x1">---</option>
<option value="320x240" selected="selected">320x240 ( für Websites und e-Mail )</option>
<option value="450x338">450x338 ( für Blogs )</option>
<option value="540x1024">540x405 ( für Blogs (2) )</option>
<option value="640x480">640x480 ( für Foren )</option>
<option value="800x600">800x600 ( 15" Monitor)</option>
<option value="1024x768">1024x768 ( 17" Monitor)</option>
<option value="1280x1024">1280x1024 ( 19" Monitor )</option>
<option value="1600x1200">1600x1200 ( 21" Monitor )</option>
<option value="x2">---</option>
<option value="640x480">640x480 ( VGA )</option>
<option value="800x600">800x600 ( SVGA )</option>
<option value="1024x768">1024x768 ( XGA )</option>
<option value="1280x1024">1280x1024 ( SXGA )</option>
<option value="1400x1050">1400x1050 ( SXGA+ )</option>
<option value="1600x120">1600x1200 ( UXGA )</option>
<option value="1920x1200">1920x1200 ( WUXGA )</option>
<option value="x3">---</option>
<option value="853x480">853x480 ( NTSC 16:9 )</option>
<option value="720x576">720x576 ( PAL 4:3 )</option>
<option value="1024x576">1024x576 ( PAL+ 16:9 )</option>
<option value="1280x720">1280x720 ( HDTV 720p )</option>
<option value="1920x1080">1920x1080 ( HDTV 1080i )</option>
</select>
</p></form><br />
<span class="gray">Werbung</span><br/>
<center>
<script type="text/javascript"><!--
google_ad_client = "pub-0375276612269505";
/* 300x250, Erstellt 09.05.09 */
google_ad_slot = "8192425434";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
<br /><br />
<!-- Wechselwerbung.de Partner Siegel -->
<a href="http://www.wechselwerbung.de/" target="_blank" title="Wechselwerbung.de - Banner Upload"><img alt="Wechselwerbung.de - Banner Upload" title="Wechselwerbung.de - Banner Upload" src="http://www.wechselwerbung.de/pics/partner.png" border="0" /></a><!-- ENDE - Wechselwerbung.de Partner Siegel -->
<br /<br />
© Copyright ImageBanana 2010<br /><a href="http://www.imagebanana.com/impressum/">Impressum</a> | <a href="http://www.ipcounter.de/" target="_blank">Kostenloser Counterservice</a> | <a href='http://www.welches-girokonto.de/' target='_blank'>Girokonto Vergleich</a><br /></p>
<div style="display:none;">
<script type="text/javascript" src="http://www.ipcounter.de/count_js.php?u=47718658&color=black"></script>
<noscript><a href="http://www.ipcounter.de/stats.php?u=47718658" target="_blank"><img src="http://www.ipcounter.de/count.php?u=47718658&color=black" alt="IPCOUNTER.DE - Kostenloser Live Counter!" border="0" /></a></noscript>
</div>
<!--<script type="text/javascript" src="http://www.imagebanana.com/layer/layer.js"></script>-->
<script type="text/javascript" src="http://www.sponsorads.de/script.php?s=99185"></script>
<!-- layer testing -->
<!--<script type="text/javascript" src="http://dev/projects/layer/layer.php"></script>-->
<!-- Copyright (c) 2000-2010 etracker GmbH. All rights reserved. -->
<!-- This material may not be reproduced, displayed, modified or distributed -->
<!-- without the express prior written permission of the copyright holder. -->
<!-- BEGIN etracker Tracklet 3.0 -->
<script type="text/javascript">document.write(String.fromCharCode(60)+"script type=\"text/javascript\" src=\"http"+("https:"==document.location.protocol?"s":"")+"://code.etracker.com/t.js?et=Cbgk3K\">"+String.fromCharCode(60)+"/script>");</script>
<script type="text/javascript">_etc();</script>
<noscript><p><a href="http://www.etracker.com"><img style="border:0px;" alt="" src="https://www.etracker.com/nscnt.php?et=Cbgk3K" /></a></p></noscript>
<!-- etracker CODE END -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-356473-12");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
Alles anzeigen