Last active
April 25, 2016 17:52
-
-
Save artemlos/449e45a034c891599476dc6ce10d5fe3 to your computer and use it in GitHub Desktop.
Sending Request to an External Website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' <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