Skip to content

Instantly share code, notes, and snippets.

@artemlos
Last active April 25, 2016 17:52
Show Gist options
  • Save artemlos/449e45a034c891599476dc6ce10d5fe3 to your computer and use it in GitHub Desktop.
Save artemlos/449e45a034c891599476dc6ce10d5fe3 to your computer and use it in GitHub Desktop.
Sending Request to an External Website
''' <summary>
''' This method will send a request to the provided url (including ?variable=value) and return an answer.
''' </summary>
''' <param name="url">The desired url.</param>
''' <returns>The content that is returned by the website. Null if it was unsuccessful.</returns>
Public Function SendRequestExternal(url As String) As String
Try
Using client As New WebClient()
client.Proxy = WebRequest.DefaultWebProxy
client.Credentials = System.Net.CredentialCache.DefaultCredentials
client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials
Return client.UploadString(url, "")
End Using
Catch
Return Nothing
End Try
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment