Jump to content
Sign in to follow this  
Jonniy

_InetGetSource Error codes

Recommended Posts

Jonniy

So what are the error codes of this function? I've not been able to find them. In the documentation there is only written, that:

Success: The read string and sets @extended to the number of bytes returned. Failure: An empty string and and sets @error to non-zero.

Now if I request a page and there is an error look at this:

http://www.imagebanana.com/view/5exwi1sp/errorseng.png

So there are different codes, and I need these to do error handling.

Code:

$var = _INetGetSource("http://myserver.com/file.txt",1)


If $var Then
 MsgBox(0,'Source',$var)
Elseif @error Then
    MsgBox(0,"Error!", "There was an error, id: " & @error & @CRLF & "More info: " & @extended)
EndIf


If you know sth. please reply.
Greets,
-Jonniy-
 

Edited by Jonniy

Thanks for your help & have a good day. Yours sincerely, -Jonniy-  

Share this post


Link to post
Share on other sites
MadaraUchiha

I also have this kind of problem.

The only results I can filter are webpage error like if it returns 403 -> Webpage not found etc, but I also don't know how to do it for a txt file...


Share this post


Link to post
Share on other sites
Jonniy

what error you get?

what is "sth"

The error is in the image. "sth." is, at least to me an abbreviation of something.


Thanks for your help & have a good day. Yours sincerely, -Jonniy-  

Share this post


Link to post
Share on other sites
guinness

You're best off looking at WinHttp to check if the website is returning a successful http response and then download.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Jonniy

You're best off looking at WinHttp to check if the website is returning a successful http response and then download.

Probably I'll do that, if no one knows where to find the codes.


Thanks for your help & have a good day. Yours sincerely, -Jonniy-  

Share this post


Link to post
Share on other sites
guinness

You're lucky I am in a good mood!

#include <Constants.au3>
#include <WinHttp.au3>

; Designed by guinness 2013.
Global Const $HTTP_GOOD_STATUSCODE = '|' & $HTTP_STATUS_OK & '|' & $HTTP_STATUS_MOVED & '|' & $HTTP_STATUS_REDIRECT & '|' & _
        $HTTP_STATUS_REDIRECT_METHOD & '|' & $HTTP_STATUS_NOT_MODIFIED & '|' & $HTTP_STATUS_REDIRECT_KEEP_VERB & '|' & _
        $HTTP_STATUS_BAD_REQUEST & '|' & $HTTP_STATUS_DENIED & '|' & $HTTP_STATUS_FORBIDDEN & '|' & _
        $HTTP_STATUS_BAD_METHOD & '|'

Example()

Func Example()
    Local $iPort = 80, _
            $sDomain = 'google.com'

    ; Open the handles.
    Local Const $hOpen = _WinHttpOpen()
    Local Const $hConnect = _WinHttpConnect($hOpen, $sDomain, $iPort)
    Local Const $hRequest = _WinHttpOpenRequest($hConnect, 'HEAD')


    ; Send a request.
    _WinHttpSendRequest($hRequest)

    ; Wait for a response.
    _WinHttpReceiveResponse($hRequest)

    ; Retrieve the http status and check if matches the OK status code.
    Local $sRequestCode = _WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_STATUS_CODE)

    ; Check if the status code is in the $HTTP_GOOD_STATUSCODE string.
    Local $fIsUp = StringInStr($HTTP_GOOD_STATUSCODE, '|' & $sRequestCode & '|') > 0

    ; Display value of $fIsUp.
    MsgBox($MB_SYSTEMMODAL, '', 'The return was: ' & $fIsUp & @CRLF)

    ; Close the handles.
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
EndFunc   ;==>Example

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Jonniy

 

You're lucky I am in a good mood!

#include <Constants.au3>
#include <WinHttp.au3>

; Designed by guinness 2013.
Global Const $HTTP_GOOD_STATUSCODE = '|' & $HTTP_STATUS_OK & '|' & $HTTP_STATUS_MOVED & '|' & $HTTP_STATUS_REDIRECT & '|' & _
        $HTTP_STATUS_REDIRECT_METHOD & '|' & $HTTP_STATUS_NOT_MODIFIED & '|' & $HTTP_STATUS_REDIRECT_KEEP_VERB & '|' & _
        $HTTP_STATUS_BAD_REQUEST & '|' & $HTTP_STATUS_DENIED & '|' & $HTTP_STATUS_FORBIDDEN & '|' & _
        $HTTP_STATUS_BAD_METHOD & '|'

Example()

Func Example()
    Local $iPort = 80, _
            $sDomain = 'google.com'

    ; Open the handles.
    Local Const $hOpen = _WinHttpOpen()
    Local Const $hConnect = _WinHttpConnect($hOpen, $sDomain, $iPort)
    Local Const $hRequest = _WinHttpOpenRequest($hConnect, 'HEAD')


    ; Send a request.
    _WinHttpSendRequest($hRequest)

    ; Wait for a response.
    _WinHttpReceiveResponse($hRequest)

    ; Retrieve the http status and check if matches the OK status code.
    Local $sRequestCode = _WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_STATUS_CODE)

    ; Check if the status code is in the $HTTP_GOOD_STATUSCODE string.
    Local $fIsUp = StringInStr($HTTP_GOOD_STATUSCODE, '|' & $sRequestCode & '|') > 0

    ; Display value of $fIsUp.
    MsgBox($MB_SYSTEMMODAL, '', 'The return was: ' & $fIsUp & @CRLF)

    ; Close the handles.
    _WinHttpCloseHandle($hRequest)
    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
EndFunc   ;==>Example

Thanks for your help. I'll test it later.

Can't be bothered just writing the error code?

I could have, but it doesn't make a real difference. In fact making that image has been taking more time, so yes, I "bothered" trying to give out more information.


Thanks for your help & have a good day. Yours sincerely, -Jonniy-  

Share this post


Link to post
Share on other sites
MadaraUchiha

Not Bad, but if it is possible with winhttp it must be possible with InetGetSource as well?

I mean the error number returned by @extended must have some meaning?


Share this post


Link to post
Share on other sites
guinness

Don't mark as answered if you haven't tested, you're only making things difficult for yourself in the future if it...

  1. Doesn't work.
  2. You don't understand it. (This is by default normally)

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
guinness

Not Bad, but if it is possible with winhttp it must be possible with InetGetSource as well?

I mean the error number returned by @extended must have some meaning?

_InetGetSource() uses InetRead(), so that gives you an idea of what the return values can be. So please check the help file to answer your question. Thanks.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
MadaraUchiha

I did...

Success: A binary string and @extended set to the number of bytes downloaded.

Failure: Sets @error to non-zero and returns an empty string.

But that is not helpful for OP's codes. We need to handle those different returned codes to allocate the correct error message for the user. ;-)


Share this post


Link to post
Share on other sites
guinness

Take those with a pinch of salt, as we (the users) have no idea about the back end of InetRead() and thus if they were used then they would be documented.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
guinness

I did...

Success: A binary string and @extended set to the number of bytes downloaded.

Failure: Sets @error to non-zero and returns an empty string.

But that is not helpful for OP's codes. We need to handle those different returned codes to allocate the correct error message for the user. ;-)

So that answers your question then.

I provided a suitable alternative by checking the website status code and working from there, quite simple and less likely to fail. Interpreting those @error codes as something else other than a generic error is going to cause you and the OP problems.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
MadaraUchiha

Perfect. That was the list I was looking for.

Code Error Message and Description

----- -----------------------------

12001 ERROR_INTERNET_OUT_OF_HANDLES

No more handles could be generated at this time.

12002 ERROR_INTERNET_TIMEOUT

The request has timed out.

12003 ERROR_INTERNET_EXTENDED_ERROR

An extended error was returned from the server. This is

typically a string or buffer containing a verbose error

message. Call InternetGetLastResponseInfo to retrieve the

error text.

12004 ERROR_INTERNET_INTERNAL_ERROR

An internal error has occurred.

12005 ERROR_INTERNET_INVALID_URL

The URL is invalid.

12006 ERROR_INTERNET_UNRECOGNIZED_SCHEME

The URL scheme could not be recognized or is not supported.

12007 ERROR_INTERNET_NAME_NOT_RESOLVED

The server name could not be resolved.

12008 ERROR_INTERNET_PROTOCOL_NOT_FOUND

The requested protocol could not be located.

12009 ERROR_INTERNET_INVALID_OPTION

A request to InternetQueryOption or InternetSetOption

specified an invalid option value.

12010 ERROR_INTERNET_BAD_OPTION_LENGTH

The length of an option supplied to InternetQueryOption or

InternetSetOption is incorrect for the type of option

specified.

12011 ERROR_INTERNET_OPTION_NOT_SETTABLE

The request option cannot be set, only queried.

12012 ERROR_INTERNET_SHUTDOWN

The Win32 Internet function support is being shut down or

unloaded.

12013 ERROR_INTERNET_INCORRECT_USER_NAME

The request to connect and log on to an FTP server could

not be completed because the supplied user name is

incorrect.

12014 ERROR_INTERNET_INCORRECT_PASSWORD

The request to connect and log on to an FTP server could

not be completed because the supplied password is

incorrect.

12015 ERROR_INTERNET_LOGIN_FAILURE

The request to connect to and log on to an FTP server

failed.

12016 ERROR_INTERNET_INVALID_OPERATION

The requested operation is invalid.

12017 ERROR_INTERNET_OPERATION_CANCELLED

The operation was canceled, usually because the handle on

which the request was operating was closed before the

operation completed.

12018 ERROR_INTERNET_INCORRECT_HANDLE_TYPE

The type of handle supplied is incorrect for this

operation.

12019 ERROR_INTERNET_INCORRECT_HANDLE_STATE

The requested operation cannot be carried out because the

handle supplied is not in the correct state.

12020 ERROR_INTERNET_NOT_PROXY_REQUEST

The request cannot be made via a proxy.

12021 ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND

A required registry value could not be located.

12022 ERROR_INTERNET_BAD_REGISTRY_PARAMETER

A required registry value was located but is an incorrect

type or has an invalid value.

12023 ERROR_INTERNET_NO_DIRECT_ACCESS

Direct network access cannot be made at this time.

12024 ERROR_INTERNET_NO_CONTEXT

An asynchronous request could not be made because a zero

context value was supplied.

12025 ERROR_INTERNET_NO_CALLBACK

An asynchronous request could not be made because a

callback function has not been set.

12026 ERROR_INTERNET_REQUEST_PENDING

The required operation could not be completed because one

or more requests are pending.

12027 ERROR_INTERNET_INCORRECT_FORMAT

The format of the request is invalid.

12028 ERROR_INTERNET_ITEM_NOT_FOUND

The requested item could not be located.

12029 ERROR_INTERNET_CANNOT_CONNECT

The attempt to connect to the server failed.

12030 ERROR_INTERNET_CONNECTION_ABORTED

The connection with the server has been terminated.

12031 ERROR_INTERNET_CONNECTION_RESET

The connection with the server has been reset.

12032 ERROR_INTERNET_FORCE_RETRY

Calls for the Win32 Internet function to redo the request.

12033 ERROR_INTERNET_INVALID_PROXY_REQUEST

The request to the proxy was invalid.

12036 ERROR_INTERNET_HANDLE_EXISTS

The request failed because the handle already exists.

12037 ERROR_INTERNET_SEC_CERT_DATE_INVALID

SSL certificate date that was received from the server is

bad. The certificate is expired.

12038 ERROR_INTERNET_SEC_CERT_CN_INVALID

SSL certificate common name (host name field) is incorrect.

For example, if you entered www.server.com and the common

name on the certificate says www.different.com.

12039 ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR

The application is moving from a non-SSL to an SSL

connection because of a redirect.

12040 ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR

The application is moving from an SSL to an non-SSL

connection because of a redirect.

12041 ERROR_INTERNET_MIXED_SECURITY

Indicates that the content is not entirely secure. Some of

the content being viewed may have come from unsecured

servers.

12042 ERROR_INTERNET_CHG_POST_IS_NON_SECURE

The application is posting and attempting to change

multiple lines of text on a server that is not secure.

12043 ERROR_INTERNET_POST_IS_NON_SECURE

The application is posting data to a server that is not

secure.

12110 ERROR_FTP_TRANSFER_IN_PROGRESS

The requested operation cannot be made on the FTP session

handle because an operation is already in progress.

12111 ERROR_FTP_DROPPED

The FTP operation was not completed because the session was

aborted.

12130 ERROR_GOPHER_PROTOCOL_ERROR

An error was detected while parsing data returned from the

gopher server.

12131 ERROR_GOPHER_NOT_FILE

The request must be made for a file locator.

12132 ERROR_GOPHER_DATA_ERROR

An error was detected while receiving data from the gopher

server.

12133 ERROR_GOPHER_END_OF_DATA

The end of the data has been reached.

12134 ERROR_GOPHER_INVALID_LOCATOR

The supplied locator is not valid.

12135 ERROR_GOPHER_INCORRECT_LOCATOR_TYPE

The type of the locator is not correct for this operation.

12136 ERROR_GOPHER_NOT_GOPHER_PLUS

The requested operation can only be made against a Gopher+

server or with a locator that specifies a Gopher+

operation.

12137 ERROR_GOPHER_ATTRIBUTE_NOT_FOUND

The requested attribute could not be located.

12138 ERROR_GOPHER_UNKNOWN_LOCATOR

The locator type is unknown.

12150 ERROR_HTTP_HEADER_NOT_FOUND

The requested header could not be located.

12151 ERROR_HTTP_DOWNLEVEL_SERVER

The server did not return any headers.

12152 ERROR_HTTP_INVALID_SERVER_RESPONSE

The server response could not be parsed.

12153 ERROR_HTTP_INVALID_HEADER

The supplied header is invalid.

12154 ERROR_HTTP_INVALID_QUERY_REQUEST

The request made to HttpQueryInfo is invalid.

12155 ERROR_HTTP_HEADER_ALREADY_EXISTS

The header could not be added because it already exists.

12156 ERROR_HTTP_REDIRECT_FAILED

The redirection failed because either the scheme changed

(for example, HTTP to FTP) or all attempts made to redirect

failed (default is five attempts).


Share this post


Link to post
Share on other sites
guinness

Well do attempt to read what I wrote please.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
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
Sign in to follow this  

×