AutID Posted September 4, 2013 Posted September 4, 2013 (edited) Hello, I was trying to create an app that will upload images on imageshack and then share them with some people. Doing a search on the forum I found a topic that MrCreator was asking for some help. Then 3 year later he came up with this script expandcollapse popup#include <Array.au3> $sFile = @ScriptDir & "large.jpg" _UploadTo_Imageshack($sFile) Func _UploadTo_Imageshack($sFile, $iRet_Type = 0) $sLocalFile = $sFile ;Local file $sKey = '79CLNOQVc318ccacdcd4716cae82f7f414ac3f8f' $sHost = 'http://imageshack.us' ;Upload page addresss $sFormAction = '/upload_api.php' ;Upload form action ("form action=...upload.php)" $sFormName = 'fileupload' ;Upload form name ("input name=uploadfile") $sResponse = _TCPFileUpload($sLocalFile, $sHost, $sFormAction, $sFormName) Local $aRet[4] = _ [ _ StringRegExpReplace($sResponse, '(?is).*<(image_link)>(.*?)</\1>.*', '\2'), _ StringRegExpReplace($sResponse, '(?is).*<(image_html)>(.*?)</\1>.*', '\2'), _ StringRegExpReplace($sResponse, '(?is).*<(image_bb)>(.*?)</\1>.*', '\2'), _ StringRegExpReplace($sResponse, '(?is).*<(image_bb2)>(.*?)</\1>.*', '\2') _ ] _ArrayDisplay($aRet) If $iRet_Type < 0 Or $iRet_Type > 3 Then $iRet_Type = 0 InputBox('Result - _UploadToImageShack', 'Show the image?', $aRet[$iRet_Type]) If Not @error Then ShellExecute($aRet[$iRet_Type]) EndFunc Func _TCPFileUpload($sLocalFile, $sHost, $sFormAction, $sFormName) Local $sFileRead, $sFileType, $sBoundary, $sData, $iDataSize, $sHeader, $sCommand, $iSocket, $sRecv $sFileRead = FileRead($sLocalFile) $sFileType = StringRegExpReplace($sLocalFile, '^.*\.', '') If $sFileType = 'jpg' Then $sFileType = 'jpeg' $sBoundary = StringFormat('----------------%s%s%smzF', @MIN, @HOUR, @SEC) $sData = '--' & $sBoundary & @CRLF & _ 'Content-Disposition: form-data; name="' & $sFormName & '"; filename="' & StringRegExpReplace($sLocalFile, '^.*\\', '') & '"' & @CRLF & _ 'Content-Type: image/' & $sFileType & @CRLF & @CRLF & _ $sFileRead & @CRLF & '--' & $sBoundary & '--' & @CRLF $iDataSize = StringLen($sData) $sHeader = 'POST ' & $sFormAction & ' HTTP/1.1' & @CRLF & _ 'Host: ' & $sHost & @CRLF & _ 'Connection: close' & @CRLF & _ 'Content-Type: multipart/form-data; boundary=' & $sBoundary & @CRLF & _ 'Content-Length: ' & $iDataSize & @CRLF & @CRLF $sCommand = $sHeader & $sData TCPStartup() $iSocket = TCPConnect(TCPNameToIP($sHost), 80) TCPSend($iSocket, $sCommand) While 1 $sRecv &= TCPRecv($iSocket, 20000) If StringLen($sRecv) <> 0 Then ExitLoop Sleep(50) WEnd TCPShutdown() Return $sRecv EndFunc My problem now is that the imageshack api seems to need an authenticator key to be able to use it. I asked and got a key but I am not really sure where I must use the key. Here is the examples but I am not really understanding them http://code.google.com/p/imageshackapi/wiki/ImageshackAPI Any ideas? Edited September 4, 2013 by AutID https://iblockify.wordpress.com/
AutID Posted September 4, 2013 Author Posted September 4, 2013 Any ideas how do I have to process the key for that site? I can't seem to understand easly the imageshackapi... Please give it a shot someone https://iblockify.wordpress.com/
Danyfirex Posted September 4, 2013 Posted September 4, 2013 Look this: '?do=embed' frameborder='0' data-embedContent>> Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now