Sub DownloadPageToString($url As String, ByRef $mem as String) As Integer


Downloads the HTML source code of the specified URL into the string $mem.


Parameters


  • $url ... Address of the page to download.
  • $mem ... String. HTML source code of the downloaded page.


Return value


This function returns the status code sent by the server. If no errors occur, this value is typically 200.


The following list shows typical return values:

  • 200 OK
  • 301 Moved Permanently
  • 302 Moved Temporarily
  • 400 Bad Request
  • 401 Unauthorized / Authentication Failure
  • 402 Payment Required
  • 403 Forbidden
  • 404 Page Not Found
  • 500 Internal Server Error
  • 501 Not Implemented
  • 502 Bad Gateway
  • 503 Service Unavailable
  • 504 Gateway Time-out


Example:

Dim $sMem

if DownloadPageToString("https://www.domain.com", $sMem) = 200 then
   if $sMem <> "" then
      ' further actions, sMem contains the page source
   End If
End If