Hasher Posted February 21, 2016 Posted February 21, 2016 Hi guys I want to check if a PDF file exists on a server . I use httprequest to do this at the moment but if it finds the file it downloads which uses a lot of bandwidth. I just want to return a true / false on if it exists or not. Below is my code , can anyone suggest a code edit to do what I need. Thanks for any help in advance. $cat = 8878000 $sTestUrl = "https://www.blah.com/files/" & StringRight(Hex($cat),6) & ".pdf" With $oHttpRequest .SetTimeouts ($ResolveTimeout, $ConnectTimeout, $SendTimeout, $ReceiveTimeout) .Open ("GET", $sTestUrl) .Send Select Case .Status = 200;No problem! Local $file = FileOpen("test2.txt", 1) fileWrite($file, "https://www.blah.com/files/" & StringRight(Hex($cat),6) & ".pdf" & @CRLF) $tempFile = "d:\temp\" & StringRight(Hex($cat),6) & ".pdf" $temp = fileopen($tempFile,2) filewrite($temp,.ResponseBody) FileClose($temp) FileClose($file) Case .Status = 404;Not found ConsoleWrite($sTestUrl & " could not be found (404 Error)" & @CR) Case Else;Some other problem ConsoleWrite("An unexpected HTTP Status value was returned: " & .Status & @CR) EndSelect EndWith Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions!
Exit Posted February 21, 2016 Posted February 21, 2016 InetGetSize ( "URL" ) ??? App: Au3toCmd UDF: _SingleScript()
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now