Jump to content

TinyPicSharer v 1.0.3.4 New Version 08 June 2013


wakillon
 Share

Recommended Posts

  • 1 month later...

Hello again,

I was trying again the other sites you have for upload and i can't make them work.

Here is what i tried...

#include <WinHTTP.au3>
#Include <String.au3>
#Include <Misc.au3>
#include <Array.au3>
#include <zlib.au3>


Global $__Var[9] = [0, 0, 0, 0, 16385, 8388608, 1, 0, 0]
Global $hGui, $hTab
Global $hTitleBarIcon, $hTitleBarNoIcon, $FlashIcon=True, $iIcon
Global $idTabItemUpload, $idTabItemOptimize, $idTabItemCapture, $idTabItemSettings, $idTabItemHistory, $idTabItemAbout
Global $idChkboxOptimize, $idChkboxOptimize2, $idChkboxCopy, $idChkboxOpen, $idChkboxTop, $idChkboxStart, $idChkboxMute, $idChkboxUpdate, $idChkboxUploadDirect
Global $iGuiWidth = 500, $iGuiHeight = 500, $GuiBkColor, $iRightMargin = 5, $iBottomMargin = 15
Global $hGraphic, $hImage, $hGraphic1, $hImage1, $sInImage, $sInImageOld, $idLabelLogo
Global $sTempDir = @TempDir & '\TPS'
Global $sRegTitleKey = 'TinyPicSharer'
Global $sRegKeySettings = _Iif ( StringInStr ( @OSArch, '64' ), 'HKCU64', 'HKCU' ) & '\SOFTWARE\TinyPicSharer\Settings'
Global $sRegKeyHistory = _Iif ( StringInStr ( @OSArch, '64' ), 'HKCU64', 'HKCU' ) & '\SOFTWARE\TinyPicSharer\History'
Global $sUpdateLink, $AlphaKey = 0xABABAB
Global $sHeader, $sBoundary, $sUploadKey, $sCookie, $sAuthenticityToken, $sTokenId, $sTokenSecret
Global $sImgurApiKey = 'f77d0b8cd41eb62792be0bf303e649df'
Global $sImageShackApiKey = '4CDFJKOXc6905717351511bd43f455621739c605'
Global $sTinyPicID = 'e2aabb8d555322fa'
Global $aWinListOld[1], $idComboList, $sTitles, $hBitmap, $hWndChoice, $hMouseGui, $sFilePath, $sFilePathOld
Global $HHook, $WM_LBUTTON_TEST=0, $START_X, $START_Y, $LF_RI_SIZE=0, $TO_BO_SIZE=0, $IMGE_L=0, $IMGE_T=0, $IMGE_W=0, $IMGE_H=0
Global $iOptimize, $iMute, $iOpenInBrowser, $iOnTop, $iCopy, $iCheckUpdate, $iUploadAfterDragAndDrop, $iClipAction, $iCursor=False
Global $aidRadioHost[10], $idChkboxClipboard1, $idChkboxClipboard2, $sProgPath, $idButtonFileDialog, $idPic, $idTab, $iGuiSlideDown, $iCurrentTab, $hLabelAcceptFile
Global $_StatusBar, $_StatusBarHeight=20
Global $iOriginalSize, $idGroup1, $idLabelSize, $idLabelNewSize, $idLabelType, $idLabelDimension, $sOriginalPreviewPath, $idButtonClear, $iToolTip, $hTimerInit, $iNewSize
Global $idSliderPicResize, $hSliderSize, $iSliderMaxVal = 1000, $idLabelNewDimension, $idChkboxResize, $idChkboxConvert, $idComboFormat, $idOptimizeProgress, $idButtonCancelOptimiz, $idButtonViewerOptimize
Global $aInfo2, $hGraphic3, $hBitmap2, $iPos, $tLayout2, $iSpeed, $sString, $sNewString, $TransColor, $idLabelScrollText, $idLabelScrollTextWidth=480, $idLabelScrollTextHeight = 20
Global $hBrush3, $hBrush2, $hFont2, $hFamily2, $hFormat2, $hPen2, $hGraphic2
Global $idInputWaterMarkText, $idComboWaterMarkPos, $idComboWaterMarkMargin, $idComboFontName, $idComboFontColor, $idComboFontSize, $idComboFontWeight, $idComboFontStyle
Global $idEditFontPreview, $idButtonAplyWMark, $idButtonCancelWMark, $idButtonViewerWMark, $idButtonSaveWMark
Global $idTabItemWaterMark, $idImgurItem
Global $idInputUpload1, $idInputUpload2, $idInputUpload3, $idInputUpload4, $idInputUpload5, $idUploadProgress, $idButtonUpload, $idButtonUploadOpenInBrowser, $idLabelUpload1
Global $aLogos[10] = [ $sTempDir & '\imgur5.png', $sTempDir & '\tinypic2.png', $sTempDir & '\imgbox2.png', $sTempDir & '\BayImg3.png', $sTempDir & '\Use3.png', _
$sTempDir & '\imageshack3.png', $sTempDir & '\abload2.png', $sTempDir & '\PostImage1.png', $sTempDir & '\ImgChili3.png', $sTempDir & '\imagebam3.png' ]
Global $aHostUrl[10] = [ 'http://imgur.com/', 'http://tinypic.com/', 'http://imgbox.com/', 'http://bayimg.com/', 'http://www.use.com/', _
'http://imageshack.us/', 'http://abload.de/', 'http://postimage.org/', 'http://imgchili.com/', 'http://www.imagebam.com/' ]
Global $idTrayItemHost[10], $idTrayItemTopic, $idTrayItemMyDocuments, $idTrayItemWebSites
Global $sUserAgent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)'
Global $idAnimatedGifCtrl, $idLabelMessage, $idAnimatedGifCtrl2, $idLabelExtracting, $iExtract, $idTabItemExtraction, $idLabelSelect, $hListViewHistory, $iSelectedSubItem2, $iHistoryTrayTip;, $idDummy



$sFile = @ScriptDir & '\large.png'
$sPicPath = $sFile
$upload = _HostImGurUpload($sPicPath)
ConsoleWrite($upload & @CRLF)
$sLinks = _HostImGurExtractLinks ($upload)
If @error Then ConsoleWrite(@error & @CRLF)
MsgBox(0, "", $sLinks[0])

$upload2 = _HostImagebamUpload($sPicPath)
ConsoleWrite($upload2 & @CRLF)
$sLinks2 = _HostImagebamExtractLinks($upload2)
If @error Then ConsoleWrite(@error & @CRLF)
MsgBox(0, "", $sLinks2[0])




Func _PicUploadProgress ( $hRequest, $sPicPath, $sDataToSend )
If Not FileExists ( $sPicPath ) Then Return SetError ( -1 )
Local $sDatas = StringToBinary ( $sDataToSend )
Local $iNumberOfBytesToSend = 2048 ; 1024; 2048; 8192
Local $Bin, $iPercent, $iStart = 1, $iExtended = 0
While 1
$Bin = BinaryMid ( $sDatas, $iStart, $iNumberOfBytesToSend )
If BinaryLen ( $Bin ) = 0 Then Return
_WinHTTPWriteData ( $hRequest, $Bin, 1 )
If Not @error Then
$iExtended += @extended
$iPercent = Round ( ( $iExtended ) / ( StringLen ( $sDataToSend ) ) * 100, 2 )
If $iPercent > 97 Then $iPercent = 97
$iStart += $iNumberOfBytesToSend
Else
$Bin = 0
Return SetError ( 1 )
EndIf
WEnd
EndFunc ;==> _PicUploadProgress ()

Func _PicReadData ( $sPicPath )
If Not FileExists ( $sPicPath ) Then Return SetError ( -1 )
Local $hFile = FileOpen ( $sPicPath )
If $hFile = -1 Then Return SetError ( 1 )
Local $sData = FileRead ( $hFile )
If @error Then Return SetError ( 2 )
FileClose ( $hFile )
Return $sData
EndFunc ;==> _PicReadData ()

Func _GetFullNameByFullPath ( $sFullPath )
Local $aFileName = StringSplit ( $sFullPath, '\' )
If Not @error Then Return $aFileName[$aFileName[0]]
Return SetError ( 1 )
EndFunc ;==> _GetFullNameByFullPath ()

Func _GetExtByFullPath ( $sFullPath )
Local $aFileName = StringSplit ( $sFullPath, '.' )
If Not @error Then Return $aFileName[$aFileName[0]]
Return SetError ( 1 )
EndFunc ;==> _GetExtByFullPath ()

Func _PicGetContentType ( $sPicPath )
If Not FileExists ( $sPicPath ) Then Return SetError ( -1 )
Local $sExt = _GetExtByFullPath ( $sPicPath )
If @error Or $sExt = '' Then Return SetError ( 1 )
Local $sContentType
Switch $sExt
Case 'jpg', 'jpe', 'jpeg'
$sContentType = 'Content-Type: image/jpeg' ; ie 'Content-Type: image/pjpeg'
Case 'gif'
$sContentType = 'Content-Type: image/gif'
Case 'bmp'
$sContentType = 'Content-Type: image/bmp'
Case 'png'
$sContentType = 'Content-Type: image/png' ; ie Content-Type: image/x-png
Case 'tif', 'tiff'
$sContentType = 'Content-Type: image/tiff'
Case Else
Return SetError ( 2 )
EndSwitch
Return $sContentType
EndFunc ;==> _PicGetContentType ()


Func _HostImagebamExtractLinks ( $HtmlData )
;~ Return Links Array
;~ [0] Link only ( viewer only, not download link)
;~ [1] Thumb
;~ [2] BBCode
;~ [3] HTML
$HtmlData = StringMid ( $HtmlData, StringInStr ( $HtmlData, 'dlinput_container', 0, 1 ) - StringLen ( 'dlinput_container' ) -1 )
Local $aRet = StringRegExp ( StringReplace ( $HtmlData, @LF, '' ), "(?s)(?i)dlinput_container(.*?)</div>", 3 )
If Not @error Then
Local $aLinks[3], $aRet1
For $i = 0 To UBound ( $aRet ) -2
$aRet1 = StringRegExp ( $aRet[$i], "(?s)(?i)value='(.*?)>", 3 )
If Not @error Then
$aRet1[0] = StringStripWS ( StringTrimRight ( $aRet1[0], 1 ), 1+2 )
$aLinks[$i] = $aRet1[0]
EndIf
Next
_ArrayReverse ( $aLinks )
Local $sUrl = _StringBetween ( $aLinks[1], '' )
If Not @error Then
_ArrayInsert ( $aLinks, 1, $sUrl[0] )
Else
Return SetError ( 2 )
EndIf
If $aLinks[UBound ( $aLinks )-1] <> '' Then
Return $aLinks
Else
Return SetError ( 3 )
EndIf
Else
Return SetError ( 1 )
EndIf
EndFunc ;==> _HostImagebamExtractLinks ()

Func _HostImagebamSetDataToSend ( $sPicPath )
Local $sData = _PicReadData ( $sPicPath )
If @error Then Return SetError ( 1 )
Local $sImageName = _GetFullNameByFullPath ( $sPicPath )
If @error Or $sImageName = '' Then Return SetError ( 2 )
Local $sContentType = _PicGetContentType ( $sPicPath )
If @error Then Return SetError ( 3 )
Local $sCdfdn = 'Content-Disposition: form-data; name'
Local $sCtaos = 'Content-Type: application/octet-stream'
Local $sString = $sBoundary & @CRLF & _
$sCdfdn & '="file[]"; filename="' & $sImageName & '"' & @CRLF & _
$sContentType & @CRLF & @CRLF & $sData & @CRLF & $sBoundary & @CRLF
For $i = 1 To 29
$sString &= $sCdfdn & '="file[]"; filename=""' & @CRLF & _
$sCtaos & @CRLF & @CRLF & @CRLF & $sBoundary & @CRLF
Next
$sString &= $sCdfdn & '="content_type"' & @CRLF & @CRLF & '0' & @CRLF & $sBoundary & @CRLF & _
$sCdfdn & '="thumb_size"' & @CRLF & @CRLF & '100' & @CRLF & $sBoundary & @CRLF & _
$sCdfdn & '="thumb_aspect_ratio"' & @CRLF & @CRLF & 'resize' & @CRLF & $sBoundary & @CRLF & _
$sCdfdn & '="thumb_file_type"' & @CRLF & @CRLF & 'jpg' & @CRLF & $sBoundary & '--'
Return SetError ( 0, '', $sString )
EndFunc ;==> _HostImagebamSetDataToSend ()

Func _HostImagebamUpload ( $sPicPath )
Local $hOpen, $hConnect, $hRequest, $sHost, $sDataToSend, $sReceivedData, $iError, $sResponse, $sPostData, $sContentType
$sHost = 'www.imagebam.com'
$hOpen = _WinHttpOpen ( $sUserAgent )
If @error Then
SetError ( 1 )
Else
$hConnect = _WinHttpConnect ( $hOpen, $sHost )
If @error Then
SetError ( 2 )
Else
$hRequest = _WinHttpOpenRequest ( $hConnect, 'POST', '/sys/upload/save', 'HTTP/1.1' )
If @error Then
SetError ( 3 )
Else
_WinHttpSetTimeouts ( $hRequest, 10000, 60000, 90000, 90000 )
$sDataToSend = _HostImagebamSetDataToSend ( $sPicPath )
_WinHttpAddRequestHeaders ( $hRequest, 'Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/x-silverlight, */*' )
_WinHttpAddRequestHeaders ( $hRequest, 'Referer: http://www.imagebam.com/basic-upload' )
_WinHttpAddRequestHeaders ( $hRequest, 'Accept-Encoding: gzip, deflate' )
_WinHttpAddRequestHeaders ( $hRequest, 'Connection: Keep-Alive' )
_WinHttpAddRequestHeaders ( $hRequest, 'Cache-Control: no-cache' )
$sContentType = 'Content-Type: multipart/form-data; boundary=' & StringTrimLeft ( $sBoundary, 2 )
_WinHttpSendRequest ( $hRequest, $sContentType, $WINHTTP_NO_REQUEST_DATA, StringLen ( $sDataToSend ) )
If @error Then
SetError ( 4 )
Else
_PicUploadProgress ( $hRequest, $sPicPath, $sDataToSend )
If Not @error Then
$hTimerInit = TimerInit ()
_WinHttpReceiveResponse ( $hRequest )
If @error Then
SetError ( 5 )
Else
If _WinHttpQueryDataAvailable ( $hRequest ) Then
$sReceivedData = Binary ( '' )
While 1
$sReceivedData &= _WinHttpReadData ( $hRequest , 2 )
If Not @extended Then
SetError ( 0 )
ExitLoop ;~
EndIf
WEnd
$sReceivedData = BinaryToString ( _ZLIB_GZUncompress ( $sReceivedData ) )
If StringInStr ( $sReceivedData, 'box_error' ) Then SetError ( 6 ) ; The thumbnail for the file pic.jpg could not be created.
Else
SetError ( 7 )
EndIf
EndIf
Else
SetError ( 8 )
EndIf
EndIf
EndIf
EndIf
EndIf
$iError = @error
If $hRequest Then _WinHttpCloseHandle ( $hRequest )
If $hConnect Then _WinHttpCloseHandle ( $hConnect )
If $hOpen Then _WinHttpCloseHandle ( $hOpen )
Return SetError ( $iError, 0, $sReceivedData )
EndFunc

Func _HostImGurExtractLinks ( $XmlData )
Local $aImGurChars[5] = ['original', 'imgur_page', 'delete_page', 'small_square', 'large_thumbnail' ]
Local $aLinks[5]
For $i = 0 To UBound ( $aLinks ) -1
$aLinks[$i] = StringRegExpReplace ( $XmlData, '(?is).*<(' & $aImGurChars[$i] & ')>(.*?)</\1>.*', '\2' )
Next
If $aLinks[4] <> '' Then
If $aLinks[UBound ( $aLinks )-1] <> '' Then
Local $sTmp = $aLinks[1]
$aLinks[1] = $aLinks[3]
$aLinks[3] = $sTmp
$sTmp = $aLinks[4]
$aLinks[4] = $aLinks[2]
$aLinks[2] = $sTmp
Return $aLinks
Else
Return SetError ( 3 )
EndIf
Else
Return SetError ( 1 )
EndIf
EndFunc ;==> _HostImGurExtractLinks ()

Func _HostImGurSetDataToSend ( $sPicPath )
Local $sData = _PicReadData ( $sPicPath )
If @error Then Return SetError ( 1 )
Local $sImageName = _GetFullNameByFullPath ( $sPicPath )
If @error Or $sImageName = '' Then Return SetError ( 2 )
Local $sContentType = _PicGetContentType ( $sPicPath )
If @error Then Return SetError ( 3 )
Return SetError ( 0, '', $sBoundary & @CRLF & _
'Content-Disposition: form-data; name="image"; filename="' & $sImageName & '"' & @CRLF & _
$sContentType & @CRLF & @CRLF & $sData & @CRLF & $sBoundary & @CRLF & _
'Content-Disposition: form-data; name="key"' & @CRLF & @CRLF & $sImgurApiKey & @CRLF & $sBoundary )
EndFunc ;==> _HostImGurSetDataToSend ()

Func _HostImGurUpload ( $sPicPath )
Local $hOpen, $hConnect, $hRequest, $sHost, $sDataToSend, $sReceivedData, $iError, $sResponse, $sPostData, $sContentType
$sHost = 'api.imgur.com'
$hOpen = _WinHttpOpen ( $sUserAgent )
If @error Then
SetError ( 1 )
Else
$hConnect = _WinHttpConnect ( $hOpen, $sHost )
If @error Then
SetError ( 2 )
Else
$hRequest = _WinHttpOpenRequest ( $hConnect, 'POST', '/2/upload.xml', 'HTTP/1.1' )
If @error Then
SetError ( 3 )
Else
_WinHttpSetTimeouts ( $hRequest, 10000, 60000, 90000, 90000 )
$sDataToSend = _HostImGurSetDataToSend ( $sPicPath )
_WinHttpAddRequestHeaders ( $hRequest, 'Accept: */*' )
_WinHttpAddRequestHeaders ( $hRequest, 'Expect: 100-continue' )
$sContentType = 'Content-Type: multipart/form-data; boundary=' & StringTrimLeft ( $sBoundary, 2 )
_WinHttpSendRequest ( $hRequest, $sContentType, $WINHTTP_NO_REQUEST_DATA, StringLen ( $sDataToSend ) )
If @error Then
SetError ( 4 )
Else
_PicUploadProgress ( $hRequest, $sPicPath, $sDataToSend )
If Not @error Then
$hTimerInit = TimerInit ()
_WinHttpReceiveResponse ( $hRequest )
If @error Then
SetError ( 5 )
Else
If _WinHttpQueryDataAvailable ( $hRequest ) Then
$sReceivedData = ''
While 1
$sReceivedData &= _WinHttpReadData ( $hRequest )
If Not @extended Then
SetError ( 0 )
ExitLoop
EndIf
WEnd
If StringInStr ( $sReceivedData, 'error' ) Then SetError ( 6 )
Else
SetError ( 7 )
EndIf
EndIf
Else
SetError ( 8 )
EndIf
EndIf
EndIf
EndIf
EndIf
$iError = @error
If $hRequest Then _WinHttpCloseHandle ( $hRequest )
If $hConnect Then _WinHttpCloseHandle ( $hConnect )
If $hOpen Then _WinHttpCloseHandle ( $hOpen )
Return SetError ( $iError, 0, $sReceivedData )
EndFunc

I have added all the global vars, copy paste :D

Link to comment
Share on other sites

Hello again,

I was trying again the other sites you have for upload and i can't make them work.

I have added all the global vars, copy paste :D

 

Try like this

#Region    ;************ Includes ************
#include <WinHTTP.au3>
#Include <String.au3>
#include <Array.au3>
#include <zlib.au3>
#EndRegion ;************ Includes ************

Global $sBoundary = '--' & _GenerateBoundary ( 30 )
Global $sImgurApiKey = 'f77d0b8cd41eb62792be0bf303e649df'
Global $sUserAgent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)'

$sPicPath = @ScriptDir & '\large.png'

$upload = _HostImGurUpload ( $sPicPath )
If Not @error Then
    $aLinks = _HostImGurExtractLinks  ( $upload )
    If Not @error Then MsgBox ( 0, "Picture Link : ", $aLinks[0] )
EndIf

$upload2 = _HostImagebamUpload ( $sPicPath )
If Not @error Then
    $aLinks2 = _HostImagebamExtractLinks ( $upload2 )
    If Not @error Then MsgBox ( 0, "Picture Link : ", $aLinks2[0] )
EndIf

Func _GenerateBoundary ( $iLen )
    Local $sString = ''
    Do
        Switch Random ( 1, 3, 1 )
            Case 1
                $sString &= Chr ( Random ( 48, 57, 1 ) )  ; 0 to 9
            Case 2
                $sString &= Chr ( Random ( 65, 90, 1 ) )  ; A to Z
            Case 3
                $sString &= Chr ( Random ( 97, 122, 1 ) ) ; a to z
        EndSwitch
    Until StringLen ( $sString ) = $iLen
    Return $sString
EndFunc ;==> _GenerateBoundary ()

Func _GetExtByFullPath ( $sFullPath )
    Local $aFileName = StringSplit ( $sFullPath, '.' )
    If Not @error Then Return $aFileName[$aFileName[0]]
    Return SetError ( 1 )
EndFunc ;==> _GetExtByFullPath ()

Func _GetFullNameByFullPath ( $sFullPath )
    Local $aFileName = StringSplit ( $sFullPath, '\' )
    If Not @error Then Return $aFileName[$aFileName[0]]
    Return SetError ( 1 )
EndFunc ;==> _GetFullNameByFullPath ()

Func _HostImagebamExtractLinks ( $HtmlData )
;~  Return Links Array
;~  [0] Link only ( viewer only, not download link)
;~  [1] Thumb
;~  [2] BBCode
;~  [3] HTML
    $HtmlData = StringMid ( $HtmlData, StringInStr ( $HtmlData, 'dlinput_container', 0, 1 ) - StringLen ( 'dlinput_container' ) -1 )
    Local $aRet = StringRegExp ( StringReplace ( $HtmlData, @LF, '' ), "(?s)(?i)dlinput_container(.*?)</div>", 3 )
    If Not @error Then
        Local $aLinks[3], $aRet1
        For $i = 0 To UBound ( $aRet ) -2
            $aRet1 = StringRegExp ( $aRet[$i], "(?s)(?i)value='(.*?)>", 3 )
            If Not @error Then
                $aRet1[0] = StringStripWS ( StringTrimRight ( $aRet1[0], 1 ), 1+2 )
                $aLinks[$i] = $aRet1[0]
            EndIf
        Next
        _ArrayReverse ( $aLinks )
        Local $sUrl = _StringBetween ( $aLinks[1], '[IMG]', '[/IMG]' )
        If Not @error Then
            _ArrayInsert ( $aLinks, 1, $sUrl[0] )
        Else
            Return SetError ( 2 )
        EndIf
        If $aLinks[UBound ( $aLinks )-1] <> '' Then
            Return $aLinks
        Else
            Return SetError ( 3 )
        EndIf
    Else
        Return SetError ( 1 )
    EndIf
EndFunc ;==> _HostImagebamExtractLinks ()

Func _HostImagebamSetDataToSend ( $sPicPath )
    Local $sData = _PicReadData ( $sPicPath )
    If @error Then Return SetError ( 1 )
    Local $sImageName = _GetFullNameByFullPath ( $sPicPath )
    If @error Or $sImageName = '' Then Return SetError ( 2 )
    Local $sContentType = _PicGetContentType ( $sPicPath )
    If @error Then Return SetError ( 3 )
    Local $sCdfdn = 'Content-Disposition: form-data; name'
    Local $sCtaos = 'Content-Type: application/octet-stream'
    Local $sString = $sBoundary & @CRLF & _
        $sCdfdn & '="file[]"; filename="' & $sImageName & '"' & @CRLF & _
        $sContentType & @CRLF & @CRLF & $sData & @CRLF & $sBoundary & @CRLF
    For $i = 1 To 29
        $sString &= $sCdfdn & '="file[]"; filename=""' & @CRLF & _
            $sCtaos & @CRLF & @CRLF & @CRLF & $sBoundary & @CRLF
    Next
    $sString &= $sCdfdn & '="content_type"' & @CRLF & @CRLF & '0' & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="thumb_size"' & @CRLF & @CRLF & '100' & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="thumb_aspect_ratio"' & @CRLF & @CRLF & 'resize' & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="thumb_file_type"' & @CRLF & @CRLF & 'jpg' & @CRLF & $sBoundary & '--'
    Return SetError ( 0, '', $sString )
EndFunc ;==> _HostImagebamSetDataToSend ()

Func _HostImagebamUpload ( $sPicPath )
    Local $hOpen, $hConnect, $hRequest, $sHost, $sDataToSend, $sReceivedData, $iError, $sResponse, $sPostData, $sContentType
    $sHost = 'www.imagebam.com'
    $hOpen = _WinHttpOpen ( $sUserAgent )
    If @error Then
        SetError ( 1 )
    Else
        $hConnect = _WinHttpConnect ( $hOpen, $sHost )
        If @error Then
            SetError ( 2 )
        Else
            $hRequest = _WinHttpOpenRequest ( $hConnect, 'POST', '/sys/upload/save', 'HTTP/1.1' )
            If @error Then
                SetError ( 3 )
            Else
                _WinHttpSetTimeouts ( $hRequest, 10000, 60000, 90000, 90000 )
                $sDataToSend = _HostImagebamSetDataToSend ( $sPicPath )
                _WinHttpAddRequestHeaders ( $hRequest, 'Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/x-silverlight, */*' )
                _WinHttpAddRequestHeaders ( $hRequest, 'Referer: http://www.imagebam.com/basic-upload' )
                _WinHttpAddRequestHeaders ( $hRequest, 'Accept-Encoding: gzip, deflate' )
                _WinHttpAddRequestHeaders ( $hRequest, 'Connection: Keep-Alive' )
                _WinHttpAddRequestHeaders ( $hRequest, 'Cache-Control: no-cache' )
                $sContentType = 'Content-Type: multipart/form-data; boundary=' & StringTrimLeft ( $sBoundary, 2 )
                _WinHttpSendRequest ( $hRequest, $sContentType, $WINHTTP_NO_REQUEST_DATA, StringLen ( $sDataToSend ) )
                If @error Then
                    SetError ( 4 )
                Else
                    _PicUploadProgress ( $hRequest, $sPicPath, $sDataToSend )
                    If Not @error Then
                        _WinHttpReceiveResponse ( $hRequest )
                        If @error Then
                            SetError ( 5 )
                        Else
                            If _WinHttpQueryDataAvailable ( $hRequest ) Then
                                $sReceivedData = Binary ( '' )
                                While 1
                                    $sReceivedData &= _WinHttpReadData ( $hRequest , 2 )
                                    If Not @extended Then
                                        SetError ( 0 )
                                        ExitLoop ;~
                                    EndIf
                                WEnd
                                $sReceivedData = BinaryToString ( _ZLIB_GZUncompress ( $sReceivedData ) )
                                If StringInStr ( $sReceivedData, 'box_error' ) Then SetError ( 6 ) ; The thumbnail for the file pic.jpg could not be created.
                            Else
                                SetError ( 7 )
                            EndIf
                        EndIf
                    Else
                        SetError ( 8 )
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
    $iError = @error
    If $hRequest Then _WinHttpCloseHandle ( $hRequest )
    If $hConnect Then _WinHttpCloseHandle ( $hConnect )
    If $hOpen Then _WinHttpCloseHandle ( $hOpen )
    Return SetError ( $iError, 0, $sReceivedData )
EndFunc ;==> _HostImagebamUpload ()

Func _HostImGurExtractLinks ( $XmlData )
    Local $aImGurChars[5] = ['original', 'imgur_page', 'delete_page', 'small_square', 'large_thumbnail' ]
    Local $aLinks[5]
    For $i = 0 To UBound ( $aLinks ) -1
        $aLinks[$i] = StringRegExpReplace ( $XmlData, '(?is).*<(' & $aImGurChars[$i] & ')>(.*?)</\1>.*', '\2' )
    Next
    If $aLinks[4] <> '' Then
        If $aLinks[UBound ( $aLinks )-1] <> '' Then
            Local $sTmp = $aLinks[1]
            $aLinks[1] = $aLinks[3]
            $aLinks[3] = $sTmp
            $sTmp = $aLinks[4]
            $aLinks[4] = $aLinks[2]
            $aLinks[2] = $sTmp
            Return $aLinks
        Else
            Return SetError ( 3 )
        EndIf
    Else
        Return SetError ( 1 )
    EndIf
EndFunc ;==> _HostImGurExtractLinks ()

Func _HostImGurSetDataToSend ( $sPicPath )
    Local $sData = _PicReadData ( $sPicPath )
    If @error Then Return SetError ( 1 )
    Local $sImageName = _GetFullNameByFullPath ( $sPicPath )
    If @error Or $sImageName = '' Then Return SetError ( 2 )
    Local $sContentType = _PicGetContentType ( $sPicPath )
    If @error Then Return SetError ( 3 )
    Return SetError ( 0, '', $sBoundary & @CRLF & _
        'Content-Disposition: form-data; name="image"; filename="' & $sImageName & '"' & @CRLF & _
        $sContentType & @CRLF & @CRLF & $sData & @CRLF & $sBoundary & @CRLF & _
        'Content-Disposition: form-data; name="key"' & @CRLF & @CRLF & $sImgurApiKey & @CRLF & $sBoundary )
EndFunc ;==> _HostImGurSetDataToSend ()

Func _HostImGurUpload ( $sPicPath )
    Local $hOpen, $hConnect, $hRequest, $sHost, $sDataToSend, $sReceivedData, $iError, $sResponse, $sPostData, $sContentType
    $sHost = 'api.imgur.com'
    $hOpen = _WinHttpOpen ( $sUserAgent )
    If @error Then
        SetError ( 1 )
    Else
        $hConnect = _WinHttpConnect ( $hOpen, $sHost )
        If @error Then
            SetError ( 2 )
        Else
            $hRequest = _WinHttpOpenRequest ( $hConnect, 'POST', '/2/upload.xml', 'HTTP/1.1' )
            If @error Then
                SetError ( 3 )
            Else
                _WinHttpSetTimeouts ( $hRequest, 10000, 60000, 90000, 90000 )
                $sDataToSend = _HostImGurSetDataToSend ( $sPicPath )
                _WinHttpAddRequestHeaders ( $hRequest, 'Accept: */*' )
                _WinHttpAddRequestHeaders ( $hRequest, 'Expect: 100-continue' )
                $sContentType = 'Content-Type: multipart/form-data; boundary=' & StringTrimLeft ( $sBoundary, 2 )
                _WinHttpSendRequest ( $hRequest, $sContentType, $WINHTTP_NO_REQUEST_DATA, StringLen ( $sDataToSend ) )
                If @error Then
                    SetError ( 4 )
                Else
                    _PicUploadProgress ( $hRequest, $sPicPath, $sDataToSend )
                    If Not @error Then
                        _WinHttpReceiveResponse ( $hRequest )
                        If @error Then
                            SetError ( 5 )
                        Else
                            If _WinHttpQueryDataAvailable ( $hRequest ) Then
                                $sReceivedData = ''
                                While 1
                                    $sReceivedData &= _WinHttpReadData ( $hRequest )
                                    If Not @extended Then
                                        SetError ( 0 )
                                        ExitLoop
                                    EndIf
                                WEnd
                                If StringInStr ( $sReceivedData, 'error' ) Then SetError ( 6 )
                            Else
                                SetError ( 7 )
                            EndIf
                        EndIf
                    Else
                        SetError ( 8 )
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
    $iError = @error
    If $hRequest Then _WinHttpCloseHandle ( $hRequest )
    If $hConnect Then _WinHttpCloseHandle ( $hConnect )
    If $hOpen Then _WinHttpCloseHandle ( $hOpen )
    Return SetError ( $iError, 0, $sReceivedData )
EndFunc ;==> _HostImGurUpload ()

Func _PicGetContentType ( $sPicPath )
    If Not FileExists ( $sPicPath ) Then Return SetError ( -1 )
    Local $sExt = _GetExtByFullPath ( $sPicPath )
    If @error Or $sExt = '' Then Return SetError ( 1 )
    Local $sContentType
    Switch $sExt
        Case 'jpg', 'jpe', 'jpeg'
            $sContentType = 'Content-Type: image/jpeg' ; ie 'Content-Type: image/pjpeg'
        Case 'gif'
            $sContentType = 'Content-Type: image/gif'
        Case 'bmp'
            $sContentType = 'Content-Type: image/bmp'
        Case 'png'
            $sContentType = 'Content-Type: image/png' ; ie Content-Type: image/x-png
        Case 'tif', 'tiff'
            $sContentType = 'Content-Type: image/tiff'
        Case Else
            Return SetError ( 2 )
    EndSwitch
    Return $sContentType
EndFunc ;==> _PicGetContentType ()

Func _PicReadData ( $sPicPath )
    If Not FileExists ( $sPicPath ) Then Return SetError ( -1 )
    Local $hFile = FileOpen ( $sPicPath )
    If $hFile = -1 Then Return SetError ( 1 )
    Local $sData = FileRead ( $hFile )
    If @error Then Return SetError ( 2 )
    FileClose ( $hFile )
    Return $sData
EndFunc ;==> _PicReadData ()

Func _PicUploadProgress ( $hRequest, $sPicPath, $sDataToSend )
    If Not FileExists ( $sPicPath ) Then Return SetError ( -1 )
    Local $sDatas = StringToBinary ( $sDataToSend )
    Local $iNumberOfBytesToSend = 2048
    Local $Bin, $iPercent, $iStart = 1, $iExtended = 0
    While 1
        $Bin = BinaryMid ( $sDatas, $iStart, $iNumberOfBytesToSend )
        If BinaryLen ( $Bin ) = 0 Then Return
        _WinHTTPWriteData ( $hRequest, $Bin, 1 )
        If Not @error Then
            $iExtended += @extended
            $iPercent =  Round ( ( $iExtended  ) / ( StringLen ( $sDataToSend ) ) * 100, 2 )
            ConsoleWrite ( '-->-- [' & StringFormat ( '%03i', @ScriptLineNumber ) & '][' & @HOUR & @MIN & @SEC & '] $iPercent : ' & $iPercent & @Crlf )
            If $iPercent > 97 Then $iPercent = 97
            $iStart += $iNumberOfBytesToSend
        Else
            $Bin = 0
            Return SetError ( 1 )
        EndIf
    WEnd
EndFunc ;==> _PicUploadProgress ()

You forgot to set the value of the $sBoundary variable !  o:)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Oups :)

What about this?

$upload4 = _HostTinyPicUpload ( $sPicPath )
If @error Then ConsoleWrite("7 " & @error & @CRLF)
$sLinks4 = _HostTinyPicExtractLinks ( $upload4 )
If @error Then
ConsoleWrite("8 " & @error & @CRLF)
Else
ConsoleWrite($sLinks4[0] & @LF)
EndIf
Does it need the _PicUploadStart() functionto update a key?

 

 

Without the TinyPic UploadKey returned, upload can not work. :)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • 1 year later...

Nice work with TinyPicSharer!

I created a UDF from your script but I was wondering if it is possible to upload to a specific user account on ImageBam?

#include <WinHTTP.au3>
#include <String.au3>
#include <Array.au3>
#include <zlib.au3>

Local $sBoundary = '--' & _GenerateBoundary(30)

; #FUNCTION# ====================================================================================================================
; Name...........: _ImagebamUpload
; Description ...: Upload image file to ImageBam.
; Syntax.........: _ImagebamUpload( $sPicPath )
; Parameters ....: $sPicPath     - Image path to upload
; Return values .: Success - Returns the link from ImageBam
;                  Failure - 0, sets @error:
;                  |1 - couldn't upload image
;                  |2 - couldn't get link
; Author ........: wakillon
; Modified.......: oapjr
; Remarks .......:
; Related .......:
; Link ..........; http://www.autoitscript.com/forum/topic/122168-tinypicsharer-v-1034-new-version-08-june-2013
; Example .......; No
; ===============================================================================================================================
Func _ImagebamUpload($sPicPath)
    $upload = _HostImagebamUpload($sPicPath)
    If @error Then
        SetError(1)
    Else
        $aLinks = _HostImagebamExtractLinks($upload)
        If @error Then
            SetError(2)
        Else
            Return $aLinks[0]
        EndIf
    EndIf
    Return 0
EndFunc   ;==>_ImagebamUpload

Func _HostImagebamUpload($sPicPath)
    Local $hOpen, $hConnect, $hRequest, $sHost, $sDataToSend, $sReceivedData, $iError, $sResponse, $sPostData, $sContentType
    Local $sUserAgent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)'
    $sHost = 'www.imagebam.com'
    $hOpen = _WinHttpOpen($sUserAgent)
    If @error Then
        SetError(1)
    Else
        $hConnect = _WinHttpConnect($hOpen, $sHost)
        If @error Then
            SetError(2)
        Else
            $hRequest = _WinHttpOpenRequest($hConnect, 'POST', '/sys/upload/save', 'HTTP/1.1')
            If @error Then
                SetError(3)
            Else
                _WinHttpSetTimeouts($hRequest, 10000, 60000, 90000, 90000)
                $sDataToSend = _HostImagebamSetDataToSend($sPicPath)
                _WinHttpAddRequestHeaders($hRequest, 'Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/x-silverlight, */*')
                _WinHttpAddRequestHeaders($hRequest, 'Referer: http://www.imagebam.com/basic-upload')
                _WinHttpAddRequestHeaders($hRequest, 'Accept-Encoding: gzip, deflate')
                _WinHttpAddRequestHeaders($hRequest, 'Connection: Keep-Alive')
                _WinHttpAddRequestHeaders($hRequest, 'Cache-Control: no-cache')
                $sContentType = 'Content-Type: multipart/form-data; boundary=' & StringTrimLeft($sBoundary, 2)
                _WinHttpSendRequest($hRequest, $sContentType, $WINHTTP_NO_REQUEST_DATA, StringLen($sDataToSend))
                If @error Then
                    SetError(4)
                Else
                    _PicUploadProgress($hRequest, $sPicPath, $sDataToSend)
                    If Not @error Then
                        _WinHttpReceiveResponse($hRequest)
                        If @error Then
                            SetError(5)
                        Else
                            If _WinHttpQueryDataAvailable($hRequest) Then
                                $sReceivedData = Binary('')
                                While 1
                                    $sReceivedData &= _WinHttpReadData($hRequest, 2)
                                    If Not @extended Then
                                        SetError(0)
                                        ExitLoop ;~
                                    EndIf
                                WEnd
                                $sReceivedData = BinaryToString( _ZLIB_GZUncompress($sReceivedData))
                                If StringInStr($sReceivedData, 'box_error') Then SetError(6) ; The thumbnail for the file pic.jpg could not be created.
                            Else
                                SetError(7)
                            EndIf
                        EndIf
                    Else
                        SetError(8)
                    EndIf
                EndIf
            EndIf
        EndIf
    EndIf
    $iError = @error
    If $hRequest Then _WinHttpCloseHandle($hRequest)
    If $hConnect Then _WinHttpCloseHandle($hConnect)
    If $hOpen Then _WinHttpCloseHandle($hOpen)
    Return SetError($iError, 0, $sReceivedData)
EndFunc   ;==>_HostImagebamUpload

Func _HostImagebamExtractLinks($HtmlData)
;~  Return Links Array
;~  [0] Link only ( viewer only, not download link)
;~  [1] Thumb
;~  [2] BBCode
;~  [3] HTML
    $HtmlData = StringMid($HtmlData, StringInStr($HtmlData, 'dlinput_container', 0, 1) - StringLen('dlinput_container') - 1)
    Local $aRet = StringRegExp(StringReplace($HtmlData, @LF, ''), "(?s)(?i)dlinput_container(.*?)</div>", 3)
    If Not @error Then
        Local $aLinks[3], $aRet1
        For $i = 0 To UBound($aRet) - 2
            $aRet1 = StringRegExp($aRet[$i], "(?s)(?i)value='(.*?)>", 3)
            If Not @error Then
                $aRet1[0] = StringStripWS(StringTrimRight($aRet1[0], 1), 1 + 2)
                $aLinks[$i] = $aRet1[0]
            EndIf
        Next
        _ArrayReverse($aLinks)
        Local $sUrl = _StringBetween($aLinks[1], '[img]', '[/IMG]')
        If Not @error Then
            _ArrayInsert($aLinks, 1, $sUrl[0])
        Else
            Return SetError(2)
        EndIf
        If $aLinks[UBound($aLinks) - 1] <> '' Then
            Return $aLinks
        Else
            Return SetError(3)
        EndIf
    Else
        Return SetError(1)
    EndIf
EndFunc   ;==>_HostImagebamExtractLinks

Func _GenerateBoundary($iLen)
    Local $sString = ''
    Do
        Switch Random(1, 3, 1)
            Case 1
                $sString &= Chr(Random(48, 57, 1)) ; 0 to 9
            Case 2
                $sString &= Chr(Random(65, 90, 1)) ; A to Z
            Case 3
                $sString &= Chr(Random(97, 122, 1)) ; a to z
        EndSwitch
    Until StringLen($sString) = $iLen
    Return $sString
EndFunc   ;==>_GenerateBoundary

Func _HostImagebamSetDataToSend($sPicPath)
    Local $sData = _PicReadData($sPicPath)
    If @error Then Return SetError(1)
    Local $sImageName = _GetFullNameByFullPath($sPicPath)
    If @error Or $sImageName = '' Then Return SetError(2)
    Local $sContentType = _PicGetContentType($sPicPath)
    If @error Then Return SetError(3)
    Local $sCdfdn = 'Content-Disposition: form-data; name'
    Local $sCtaos = 'Content-Type: application/octet-stream'
    Local $sString = $sBoundary & @CRLF & _
            $sCdfdn & '="file[]"; filename="' & $sImageName & '"' & @CRLF & _
            $sContentType & @CRLF & @CRLF & $sData & @CRLF & $sBoundary & @CRLF
    For $i = 1 To 29
        $sString &= $sCdfdn & '="file[]"; filename=""' & @CRLF & _
                $sCtaos & @CRLF & @CRLF & @CRLF & $sBoundary & @CRLF
    Next
    $sString &= $sCdfdn & '="content_type"' & @CRLF & @CRLF & '0' & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="thumb_size"' & @CRLF & @CRLF & '100' & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="thumb_aspect_ratio"' & @CRLF & @CRLF & 'resize' & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="thumb_file_type"' & @CRLF & @CRLF & 'jpg' & @CRLF & $sBoundary & '--'
    Return SetError(0, '', $sString)
EndFunc   ;==>_HostImagebamSetDataToSend

Func _PicUploadProgress($hRequest, $sPicPath, $sDataToSend)
    If Not FileExists($sPicPath) Then Return SetError(-1)
    Local $sDatas = StringToBinary($sDataToSend)
    Local $iNumberOfBytesToSend = 2048
    Local $Bin, $iPercent, $iStart = 1, $iExtended = 0
    While 1
        $Bin = BinaryMid($sDatas, $iStart, $iNumberOfBytesToSend)
        If BinaryLen($Bin) = 0 Then Return
        _WinHTTPWriteData($hRequest, $Bin, 1)
        If Not @error Then
            $iExtended += @extended
            $iPercent = Round(($iExtended) / (StringLen($sDataToSend)) * 100, 2)
            ConsoleWrite('-->-- [' & StringFormat('%03i', @ScriptLineNumber) & '][' & @HOUR & @MIN & @SEC & '] $iPercent : ' & $iPercent & @CRLF)
            If $iPercent > 97 Then $iPercent = 97
            $iStart += $iNumberOfBytesToSend
        Else
            $Bin = 0
            Return SetError(1)
        EndIf
    WEnd
EndFunc   ;==>_PicUploadProgress

Func _PicGetContentType($sPicPath)
    If Not FileExists($sPicPath) Then Return SetError(-1)
    Local $sExt = _GetExtByFullPath($sPicPath)
    If @error Or $sExt = '' Then Return SetError(1)
    Local $sContentType
    Switch $sExt
        Case 'jpg', 'jpe', 'jpeg'
            $sContentType = 'Content-Type: image/jpeg' ; ie 'Content-Type: image/pjpeg'
        Case 'gif'
            $sContentType = 'Content-Type: image/gif'
        Case 'bmp'
            $sContentType = 'Content-Type: image/bmp'
        Case 'png'
            $sContentType = 'Content-Type: image/png' ; ie Content-Type: image/x-png
        Case 'tif', 'tiff'
            $sContentType = 'Content-Type: image/tiff'
        Case Else
            Return SetError(2)
    EndSwitch
    Return $sContentType
EndFunc   ;==>_PicGetContentType

Func _PicReadData($sPicPath)
    If Not FileExists($sPicPath) Then Return SetError(-1)
    Local $hFile = FileOpen($sPicPath)
    If $hFile = -1 Then Return SetError(1)
    Local $sData = FileRead($hFile)
    If @error Then Return SetError(2)
    FileClose($hFile)
    Return $sData
EndFunc   ;==>_PicReadData

Func _GetFullNameByFullPath($sFullPath)
    Local $aFileName = StringSplit($sFullPath, '\')
    If Not @error Then Return $aFileName[$aFileName[0]]
    Return SetError(1)
EndFunc   ;==>_GetFullNameByFullPath

Func _GetExtByFullPath($sFullPath)
    Local $aFileName = StringSplit($sFullPath, '.')
    If Not @error Then Return $aFileName[$aFileName[0]]
    Return SetError(1)
EndFunc   ;==>_GetExtByFullPath
Link to comment
Share on other sites

 

Nice work with TinyPicSharer!

I created a UDF from your script but I was wondering if it is possible to upload to a specific user account on ImageBam?

 

Thanks.  :)

$sBoundary need to be a global variable.

here is for be logged-in

#include 'WinHttp.au3'

$sNickName = '' 
$sPassword = ''
;~ $sHtmlPath = @DesktopDir & '\login.html'
$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect ( $hOpen, 'www.imagebam.com' )
$sHtml = _WinHttpSimpleFormFill ( $hConnect, '/login', 'loginform2', 'name:nick', $sNickName, 'name:pw', $sPassword )
If @error Then ConsoleWrite ( '! @error : ' & @error & @Crlf )
ConsoleWrite ( '$sHtml : ' & $sHtml & @Crlf )
;~ FileWrite ( $sHtmlPath, $sHtml )
;~ ShellExecute ( $sHtmlPath )

; only close handles when upload is finished for not be logged out!


_WinHttpCloseHandle ( $hConnect )
_WinHttpCloseHandle ( $hOpen )

There is a "key" to recover in the html source return by this function, that we need for upload to the gallery

This key is also a part of the gallery Url : http://www.imagebam.com/gallery/dap34gcxxxxxxxxxxxx97e0xr

 

;~      <select name="gallery_existing" id="gallery_existing" class="input_sub" style="width:510px;">

;~                    <option value="x">SELECT GALLERY</option>
;~                    <option value='dap34gcxxxxxxxxxxxx97e0xr'>YourGalleryName</option>               </select>
;~            </div><!--/gallery_options_2-->

 

I'm working to the upload function but i meet some difficulties.

I'll see what I can do.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Now, once logged in, creation of gallery is possible without uploading a file.

#Region    ;************ Includes ************
#Include <ZLIB.au3>
#include<WinHttp.au3>
#EndRegion ;************ Includes ************

; login
$sNickName = ''
$sPassword = ''

$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect ( $hOpen, 'www.imagebam.com' )
$sHtml = _WinHttpSimpleFormFill ( $hConnect, '/login', 'loginform2', 'name:nick', $sNickName, 'name:pw', $sPassword )

; create a gallery
$sGalleryName = 'MyGalleryName'
$sGalleryDescription = 'MyGalleryDescription'

$hRequest = _WinHttpOpenRequest ( $hConnect, 'POST', '/sys/ajax/gallery/create_json' )
_WinHttpAddRequestHeaders ( $hRequest, 'Accept-Encoding: gzip, deflate' )
_WinHttpAddRequestHeaders ( $hRequest, 'Content-Type: application/x-www-form-urlencoded' )
$sPost = 'content_type=0&thumb_size=100&thumb_aspect_ratio=resize&thumb_file_type=jpg&gallery_options=1&gallery_title=' & $sGalleryName & '&gallery_description=' & $sGalleryDescription & '&gallery_existing=x'
_WinHttpSendRequest ( $hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS, $sPost, StringLen ( $sPost ) )
_WinHttpReceiveResponse ( $hRequest )
If _WinHttpQueryDataAvailable($hRequest) Then
    $sReceivedData = Binary ( '' )
    While 1
        $sReceivedData &= _WinHttpReadData ( $hRequest, 2 )
        If Not @extended Then ExitLoop
    WEnd
    $sReceivedData = BinaryToString ( _ZLIB_GZUncompress ( $sReceivedData ) )
EndIf

ConsoleWrite ( '$sReceivedData : ' & $sReceivedData & @Crlf ) ; {"status":"OK","GID":"xbc347j9gxxxxxxxxxxxxd9wndfq9ln"}

_WinHttpCloseHandle ( $hRequest )
_WinHttpCloseHandle ( $hConnect )
_WinHttpCloseHandle ( $hOpen )

In the received datas you will need to extract the "key" for get the gallery url as i mentioned in previous post.

:)

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Now Gallery Deletion using the "key" for identify the gallery.

#Region    ;************ Includes ************
#Include <ZLIB.au3>
#include<WinHttp.au3>
#EndRegion ;************ Includes ************

; login
$sNickName = ''
$sPassword = ''

$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect ( $hOpen, 'www.imagebam.com' )
$sHtml = _WinHttpSimpleFormFill ( $hConnect, '/login', 'loginform2', 'name:nick', $sNickName, 'name:pw', $sPassword )

; Delete a gallery

$hRequest = _WinHttpOpenRequest ( $hConnect, 'POST', '/sys/browse/delete_gallery/' )
_WinHttpAddRequestHeaders ( $hRequest, 'Accept-Encoding: gzip, deflate' )
_WinHttpAddRequestHeaders ( $hRequest, 'Content-Type: application/x-www-form-urlencoded' )
$sPost = 'GID=a8yayuxmxxxxxxxxxxbjekez4u518g'
_WinHttpSendRequest ( $hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS, $sPost, StringLen ( $sPost ) )
_WinHttpReceiveResponse ( $hRequest )
If _WinHttpQueryDataAvailable($hRequest) Then
    $sReceivedData = Binary ( '' )
    While 1
        $sReceivedData &= _WinHttpReadData ( $hRequest, 2 )
        If Not @extended Then ExitLoop
    WEnd
    $sReceivedData = BinaryToString ( _ZLIB_GZUncompress ( $sReceivedData ) )
EndIf

ConsoleWrite ( '$sReceivedData : ' & $sReceivedData & @Crlf ) ; a8yayuxmxxxxxxxxxxbjekez4u518gOK
_WinHttpCloseHandle ( $hRequest )
_WinHttpCloseHandle ( $hConnect )
_WinHttpCloseHandle ( $hOpen )

If the deletion is done, it returns the submited key & 'OK'.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Now for Upload to Gallery

Func _HostImagebamSetDataToSendToGallery ( $sPicPath, $sGID, $GalleryName, $GalleryDescription='' )
    Local $sData = _PicReadData ( $sPicPath )
    If @error Then Return SetError ( 1 )
    Local $sImageName = _GetFullNameByFullPath ( $sPicPath )
    If @error Or $sImageName = '' Then Return SetError ( 2 )
    Local $sContentType = _PicGetContentType ( $sPicPath )
    If @error Then Return SetError ( 3 )
    Local $sCdfdn = 'Content-Disposition: form-data; name'
    Local $sCtaos = 'Content-Type: application/octet-stream'
    Local $sString = $sBoundary & @CRLF & _
        $sCdfdn & '="file[]"; filename="' & $sImageName & '"' & @CRLF & _
        $sContentType & @CRLF & @CRLF & $sData & @CRLF & $sBoundary & @CRLF
    For $i = 1 To 29
        $sString &= $sCdfdn & '="file[]"; filename=""' & @CRLF & _
            $sCtaos & @CRLF & @CRLF & @CRLF & $sBoundary & @CRLF
    Next
    $sString &= $sCdfdn & '="content_type"' & @CRLF & @CRLF & '0'                        & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="thumb_size"'           & @CRLF & @CRLF & '100'                      & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="thumb_aspect_ratio"'   & @CRLF & @CRLF & 'resize'                   & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="thumb_file_type"'      & @CRLF & @CRLF & 'jpg'                      & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="gallery_options"'      & @CRLF & @CRLF & '2'                        & @CRLF & $sBoundary & @CRLF & _ ; 2 : add
        $sCdfdn & '="gallery_title"'        & @CRLF & @CRLF & $GalleryName               & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="gallery_description"'  & @CRLF & @CRLF & $GalleryDescription        & @CRLF & $sBoundary & @CRLF & _
        $sCdfdn & '="gallery_existing"'     & @CRLF & @CRLF & $sGID & @CRLF & $sBoundary & '--'
    Return SetError ( 0, '', $sString )
EndFunc ;==> _HostImagebamSetDataToSendToGallery()


Func _HostImagebamUploadToGallery ( $sPicPath, $sGID, $GalleryName, $GalleryDescription='' )
    Local $hRequest, $sDataToSend, $sReceivedData, $iError, $sResponse, $sPostData, $sContentType
    $hRequest = _WinHttpOpenRequest ( $hConnect, 'POST', '/sys/upload/save', 'HTTP/1.1' )
    If @error Then
        SetError ( 3 )
    Else
        _WinHttpSetTimeouts ( $hRequest, 10000, 60000, 90000, 90000 )
        $sDataToSend = _HostImagebamSetDataToSendToGallery ( $sPicPath, $sGID, $GalleryName, $GalleryDescription )
        _WinHttpAddRequestHeaders ( $hRequest, 'Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*' )
        _WinHttpAddRequestHeaders ( $hRequest, 'Referer: http://www.imagebam.com/basic-upload' )
        _WinHttpAddRequestHeaders ( $hRequest, 'Host: www.imagebam.com' )
        _WinHttpAddRequestHeaders ( $hRequest, 'Accept-Encoding: gzip, deflate' )
        _WinHttpAddRequestHeaders ( $hRequest, 'Connection: Keep-Alive' )
        _WinHttpAddRequestHeaders ( $hRequest, 'Cache-Control: no-cache' )
        $sContentType = 'Content-Type: multipart/form-data; boundary=' & StringTrimLeft ( $sBoundary, 2 )
        _WinHttpSendRequest ( $hRequest, $sContentType, $WINHTTP_NO_REQUEST_DATA, StringLen ( $sDataToSend ) )
        If @error Then
            SetError ( 4 )
        Else
            _PicUploadProgress ( $hRequest, $sPicPath, $sDataToSend )
            If Not @error Then
                _WinHttpReceiveResponse ( $hRequest )
                If @error Then
                    SetError ( 5 )
                Else
                    If _WinHttpQueryDataAvailable ( $hRequest ) Then
                        $sReceivedData = Binary ( '' )
                        While 1
                            $sReceivedData &= _WinHttpReadData ( $hRequest, 2 )
                            If Not @extended Then
                                SetError ( 0 )
                                ExitLoop ;~
                            EndIf
                        WEnd
                        $sReceivedData = BinaryToString ( _ZLIB_GZUncompress ( $sReceivedData ) )
                        If StringInStr ( $sReceivedData, 'box_error' ) Then SetError ( 6 ) ; The thumbnail for the file pic.jpg could not be created.
                    Else
                        SetError ( 7 )
                    EndIf
                EndIf
            Else
                SetError ( 8 )
            EndIf
        EndIf
    EndIf
    $iError = @error
    If $hRequest Then _WinHttpCloseHandle ( $hRequest )
    If $hConnect Then _WinHttpCloseHandle ( $hConnect )
    If $hOpen Then _WinHttpCloseHandle ( $hOpen )
    Return SetError ( $iError, 0, $sReceivedData )
EndFunc ;==> _HostImagebamUploadToGallery()

$sGID is the key return after gallery creation.

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

You are good with WinHTTP! Do you know a good place where I can learn more about WinHTTP?
 
To get the Gallery ID would be something like this?

Func _GetGalleryID($sReceivedData)
    Local $sPattern = '"GID":"(\w++)"}'
    If StringRegExp($sReceivedData,$sPattern,0) Then
        Return StringRegExp($sReceivedData,$sPattern,1)[0]
    Else
        Return ''
    EndIf
EndFunc

gallery creation, deletion and upload to gallery are working fine :)
 

#include <WinHTTP.au3>
#include <String.au3>
#include <Array.au3>
#include <zlib.au3>

$sBoundary = '--' & _GenerateBoundary(30)

; login
$sNickName = ''
$sPassword = ''

$sPicPath = ''
$GalleryName = ''

$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, 'www.imagebam.com')
$sHtml = _WinHttpSimpleFormFill($hConnect, '/login', 'loginform2', 'name:nick', $sNickName, 'name:pw', $sPassword)

$sGID = _GalleryCreate($hConnect, $GalleryName)

Sleep(10000)

_HostImagebamUploadToGallery($sPicPath, $sGID, $GalleryName)

Sleep(10000)

_GalleryDelete($hConnect, $sGID)

_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

#Region
Func _HostImagebamUploadToGallery($sPicPath, $sGID, $GalleryName, $GalleryDescription = '')
    Local $hRequest, $sDataToSend, $sReceivedData, $iError, $sResponse, $sPostData, $sContentType
    $hRequest = _WinHttpOpenRequest($hConnect, 'POST', '/sys/upload/save', 'HTTP/1.1')
    If @error Then
        SetError(3)
    Else
        _WinHttpSetTimeouts($hRequest, 10000, 60000, 90000, 90000)
        $sDataToSend = _HostImagebamSetDataToSendToGallery($sPicPath, $sGID, $GalleryName, $GalleryDescription)
        _WinHttpAddRequestHeaders($hRequest, 'Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*')
        _WinHttpAddRequestHeaders($hRequest, 'Referer: http://www.imagebam.com/basic-upload')
        _WinHttpAddRequestHeaders($hRequest, 'Host: www.imagebam.com')
        _WinHttpAddRequestHeaders($hRequest, 'Accept-Encoding: gzip, deflate')
        _WinHttpAddRequestHeaders($hRequest, 'Connection: Keep-Alive')
        _WinHttpAddRequestHeaders($hRequest, 'Cache-Control: no-cache')
        $sContentType = 'Content-Type: multipart/form-data; boundary=' & StringTrimLeft($sBoundary, 2)
        _WinHttpSendRequest($hRequest, $sContentType, $WINHTTP_NO_REQUEST_DATA, StringLen($sDataToSend))
        If @error Then
            SetError(4)
        Else
            _PicUploadProgress($hRequest, $sPicPath, $sDataToSend)
            If Not @error Then
                _WinHttpReceiveResponse($hRequest)
                If @error Then
                    SetError(5)
                Else
                    If _WinHttpQueryDataAvailable($hRequest) Then
                        $sReceivedData = Binary('')
                        While 1
                            $sReceivedData &= _WinHttpReadData($hRequest, 2)
                            If Not @extended Then
                                SetError(0)
                                ExitLoop ;~
                            EndIf
                        WEnd
                        $sReceivedData = BinaryToString( _ZLIB_GZUncompress($sReceivedData))
                        If StringInStr($sReceivedData, 'box_error') Then SetError(6) ; The thumbnail for the file pic.jpg could not be created.
                    Else
                        SetError(7)
                    EndIf
                EndIf
            Else
                SetError(8)
            EndIf
        EndIf
    EndIf
    $iError = @error
    If $hRequest Then _WinHttpCloseHandle($hRequest)
    Return SetError($iError, 0, $sReceivedData)
EndFunc   ;==>_HostImagebamUploadToGallery

Func _HostImagebamSetDataToSendToGallery($sPicPath, $sGID, $GalleryName, $GalleryDescription = '')
    Local $sData = _PicReadData($sPicPath)
    If @error Then Return SetError(1)
    Local $sImageName = _GetFullNameByFullPath($sPicPath)
    If @error Or $sImageName = '' Then Return SetError(2)
    Local $sContentType = _PicGetContentType($sPicPath)
    If @error Then Return SetError(3)
    Local $sCdfdn = 'Content-Disposition: form-data; name'
    Local $sCtaos = 'Content-Type: application/octet-stream'
    Local $sString = $sBoundary & @CRLF & _
            $sCdfdn & '="file[]"; filename="' & $sImageName & '"' & @CRLF & _
            $sContentType & @CRLF & @CRLF & $sData & @CRLF & $sBoundary & @CRLF
    For $i = 1 To 29
        $sString &= $sCdfdn & '="file[]"; filename=""' & @CRLF & _
                $sCtaos & @CRLF & @CRLF & @CRLF & $sBoundary & @CRLF
    Next
    $sString &= $sCdfdn & '="content_type"' & @CRLF & @CRLF & '0' & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="thumb_size"' & @CRLF & @CRLF & '100' & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="thumb_aspect_ratio"' & @CRLF & @CRLF & 'resize' & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="thumb_file_type"' & @CRLF & @CRLF & 'jpg' & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="gallery_options"' & @CRLF & @CRLF & '2' & @CRLF & $sBoundary & @CRLF & _ ; 2 : add
            $sCdfdn & '="gallery_title"' & @CRLF & @CRLF & $GalleryName & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="gallery_description"' & @CRLF & @CRLF & $GalleryDescription & @CRLF & $sBoundary & @CRLF & _
            $sCdfdn & '="gallery_existing"' & @CRLF & @CRLF & $sGID & @CRLF & $sBoundary & '--'
    Return SetError(0, '', $sString)
EndFunc   ;==>_HostImagebamSetDataToSendToGallery

Func _GalleryCreate($hConnect, $sGalleryName, $sGalleryDescription = '')
    $hRequest = _WinHttpOpenRequest($hConnect, 'POST', '/sys/ajax/gallery/create_json')
    _WinHttpAddRequestHeaders($hRequest, 'Accept-Encoding: gzip, deflate')
    _WinHttpAddRequestHeaders($hRequest, 'Content-Type: application/x-www-form-urlencoded')
    $sPost = 'content_type=0&thumb_size=100&thumb_aspect_ratio=resize&thumb_file_type=jpg&gallery_options=1&gallery_title=' & $sGalleryName & '&gallery_description=' & $sGalleryDescription & '&gallery_existing=x'
    _WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS, $sPost, StringLen($sPost))
    _WinHttpReceiveResponse($hRequest)
    If _WinHttpQueryDataAvailable($hRequest) Then
        $sReceivedData = Binary('')
        While 1
            $sReceivedData &= _WinHttpReadData($hRequest, 2)
            If Not @extended Then ExitLoop
        WEnd
        $sReceivedData = BinaryToString( _ZLIB_GZUncompress($sReceivedData))
    EndIf

    ConsoleWrite('$sReceivedData : ' & $sReceivedData & @CRLF) ; {"status":"OK","GID":"xbc347j9gxxxxxxxxxxxxd9wndfq9ln"}

    _WinHttpCloseHandle($hRequest)

    Return _GetGalleryID($sReceivedData)
EndFunc   ;==>_GalleryCreate

Func _GalleryDelete($hConnect, $sGID)
    $hRequest = _WinHttpOpenRequest($hConnect, 'POST', '/sys/browse/delete_gallery/')
    _WinHttpAddRequestHeaders($hRequest, 'Accept-Encoding: gzip, deflate')
    _WinHttpAddRequestHeaders($hRequest, 'Content-Type: application/x-www-form-urlencoded')
    $sPost = 'GID=' & $sGID
    _WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS, $sPost, StringLen($sPost))
    _WinHttpReceiveResponse($hRequest)
    If _WinHttpQueryDataAvailable($hRequest) Then
        $sReceivedData = Binary('')
        While 1
            $sReceivedData &= _WinHttpReadData($hRequest, 2)
            If Not @extended Then ExitLoop
        WEnd
        $sReceivedData = BinaryToString( _ZLIB_GZUncompress($sReceivedData))
    EndIf

    ConsoleWrite('$sReceivedData : ' & $sReceivedData & @CRLF) ; a8yayuxmxxxxxxxxxxbjekez4u518gOK
    _WinHttpCloseHandle($hRequest)
EndFunc   ;==>_GalleryDelete

Func _GetGalleryID($sReceivedData)
    Local $sPattern = '"GID":"(\w++)"}'
    If StringRegExp($sReceivedData, $sPattern, 0) Then
        Return StringRegExp($sReceivedData, $sPattern, 1)[0]
    Else
        Return ''
    EndIf
EndFunc   ;==>_GetGalleryID
#EndRegion

Func _PicUploadProgress($hRequest, $sPicPath, $sDataToSend)
    If Not FileExists($sPicPath) Then Return SetError(-1)
    Local $sDatas = StringToBinary($sDataToSend)
    Local $iNumberOfBytesToSend = 2048
    Local $Bin, $iPercent, $iStart = 1, $iExtended = 0
    While 1
        $Bin = BinaryMid($sDatas, $iStart, $iNumberOfBytesToSend)
        If BinaryLen($Bin) = 0 Then Return
        _WinHTTPWriteData($hRequest, $Bin, 1)
        If Not @error Then
            $iExtended += @extended
            $iPercent = Round(($iExtended) / (StringLen($sDataToSend)) * 100, 2)
            ConsoleWrite('-->-- [' & StringFormat('%03i', @ScriptLineNumber) & '][' & @HOUR & @MIN & @SEC & '] $iPercent : ' & $iPercent & @CRLF)
            If $iPercent > 97 Then $iPercent = 97
            $iStart += $iNumberOfBytesToSend
        Else
            $Bin = 0
            Return SetError(1)
        EndIf
    WEnd
EndFunc   ;==>_PicUploadProgress

Func _GenerateBoundary($iLen)
    Local $sString = ''
    Do
        Switch Random(1, 3, 1)
            Case 1
                $sString &= Chr(Random(48, 57, 1)) ; 0 to 9
            Case 2
                $sString &= Chr(Random(65, 90, 1)) ; A to Z
            Case 3
                $sString &= Chr(Random(97, 122, 1)) ; a to z
        EndSwitch
    Until StringLen($sString) = $iLen
    Return $sString
EndFunc   ;==>_GenerateBoundary

Func _PicGetContentType($sPicPath)
    If Not FileExists($sPicPath) Then Return SetError(-1)
    Local $sExt = _GetExtByFullPath($sPicPath)
    If @error Or $sExt = '' Then Return SetError(1)
    Local $sContentType
    Switch $sExt
        Case 'jpg', 'jpe', 'jpeg'
            $sContentType = 'Content-Type: image/jpeg' ; ie 'Content-Type: image/pjpeg'
        Case 'gif'
            $sContentType = 'Content-Type: image/gif'
        Case 'bmp'
            $sContentType = 'Content-Type: image/bmp'
        Case 'png'
            $sContentType = 'Content-Type: image/png' ; ie Content-Type: image/x-png
        Case 'tif', 'tiff'
            $sContentType = 'Content-Type: image/tiff'
        Case Else
            Return SetError(2)
    EndSwitch
    Return $sContentType
EndFunc   ;==>_PicGetContentType

Func _PicReadData($sPicPath)
    If Not FileExists($sPicPath) Then Return SetError(-1)
    Local $hFile = FileOpen($sPicPath)
    If $hFile = -1 Then Return SetError(1)
    Local $sData = FileRead($hFile)
    If @error Then Return SetError(2)
    FileClose($hFile)
    Return $sData
EndFunc   ;==>_PicReadData

Func _GetFullNameByFullPath($sFullPath)
    Local $aFileName = StringSplit($sFullPath, '\')
    If Not @error Then Return $aFileName[$aFileName[0]]
    Return SetError(1)
EndFunc   ;==>_GetFullNameByFullPath

Func _GetExtByFullPath($sFullPath)
    Local $aFileName = StringSplit($sFullPath, '.')
    If Not @error Then Return $aFileName[$aFileName[0]]
    Return SetError(1)
EndFunc   ;==>_GetExtByFullPath

Link to comment
Share on other sites

I think this is the code to delete a picture: :D

#include <WinHTTP.au3>
#include <String.au3>
#include <Array.au3>
#include <zlib.au3>

$sBoundary = '--' & _GenerateBoundary(30)

; login
$sNickName = ''
$sPassword = ''

$sImageID = ''

$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, 'www.imagebam.com')
$sHtml = _WinHttpSimpleFormFill($hConnect, '/login', 'loginform2', 'name:nick', $sNickName, 'name:pw', $sPassword)

$hRequest = _WinHttpOpenRequest($hConnect, 'POST', '/sys/browse/delete/', 'HTTP/1.1')
_WinHttpAddRequestHeaders($hRequest, 'Accept-Encoding: gzip, deflate')
_WinHttpAddRequestHeaders($hRequest, 'Content-Type: application/x-www-form-urlencoded')
$sPost = 'images=' & $sImageID
_WinHttpSendRequest($hRequest, $WINHTTP_NO_ADDITIONAL_HEADERS, $sPost, StringLen($sPost))
_WinHttpReceiveResponse($hRequest)
If _WinHttpQueryDataAvailable($hRequest) Then
    $sReceivedData = Binary('')
    While 1
        $sReceivedData &= _WinHttpReadData($hRequest, 2)
        If Not @extended Then ExitLoop
    WEnd
    $sReceivedData = BinaryToString( _ZLIB_GZUncompress($sReceivedData))
EndIf

ConsoleWrite('$sReceivedData : ' & $sReceivedData & @CRLF) ; a8yayuxmxxxxxxxxxxbjekez4u518gOK
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
Link to comment
Share on other sites

You are good with WinHTTP! Do you know a good place where I can learn more about WinHTTP?

 

 

Thanks.

You can browse the trancexx WinHttp >Topic where you can find lot of examples,

and also the WinHttp.chm provided with WinHttp.au3 where there is some examples too !

And also here !  ;)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts

Link to comment
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
 Share

×
×
  • Create New...