vb.net - How can I use Visual Basic to find the size of a specific web page? -
i've been researching how , cannot find answers unfortunately. find exact size of specific web page, or if not possible, word/character count of specific web page's source code.
i doing in order find pages of web site exist, opposed pages don't exist via strings, if statements, , loops testing out every possible numeric combination after "/" in front of website's url, , excluding pages below size, pages load 404 error, or not exist error, means resulting pages exist. these pages looking have no link them , cannot found on search engine. way them type exact number after "/" it, example: (http://website.com/123456789) perhaps improvised brute force method find pages looking for. thanks!
dim url string 'requesting file details dim req system.net.webrequest = system.net.httpwebrequest.create(url) req.method = "head" 'retriving response dim resp system.net.webresponse = req.getresponse() dim contentlength long = 0 dim result long 'finding file size if long.tryparse(resp.headers.get("content-length"), contentlength) dim file_size string if contentlength >= 1073741824 result = contentlength / 1073741824 elseif contentlength >= 1048576 result = contentlength / 1048576 else result = contentlength / 1024 end if file_size = result.tostring("0.00") end if check 404 pages
private function remotefileok(byval url string) boolean using client new httpclient, responsetask task(of httpresponsemessage) = client.getasync(url, httpcompletionoption.responseheadersread) responsetask.wait() using response httpresponsemessage = responsetask.result return response.issuccessstatuscode end using end using end function
Comments
Post a Comment