开发者

Visual Basic equivalent to file get contents?

开发者 https://www.devze.com 2023-03-22 01:46 出处:网络
Is there a function in Visual Basic that does the same thing as file_get_contents in PHP. I\'m a PHP programmer, and I want to write a few scripts to dow开发者_StackOverflownload some data from an API

Is there a function in Visual Basic that does the same thing as file_get_contents in PHP. I'm a PHP programmer, and I want to write a few scripts to dow开发者_StackOverflownload some data from an API I'm using.


In VB.Net (I'm assuming that's what you're looking for), I think you'd want to look at the WebClient.DownloadFile method (http://msdn.microsoft.com/en-us/library/ez801hhe.aspx) if the file you want is on the web. If it's a local file you could use...

My.Computer.FileSystem.ReadAllText("C:\test.txt")

I'm not familiar with PHP's file_get_contents but if it's asynch you can call WebClient.DownloadFileAsync

0

精彩评论

暂无评论...
验证码 换一张
取 消