login about faq

To prove you're not a spammer, email newuser.lgqa@gmail.com with the subject "Account Request" to request an account.


What is Visual Basic.NET equivalent of the PHP "file_get_contents()" function? Is it basically ".ToString()"? Thanks.

asked May 19 '12 at 09:04

RafalChmiel's gravatar image

RafalChmiel
491141151156


x[string variable/text property etc.] = My.Computer.FileSystem.ReadAllText()

answered May 19 '12 at 09:15

Cornelia%20Cornflake's gravatar image

Cornelia Cornflake
8802316

Thank you, so what would "$content = file_get_contents($url);" be?

(May 19 '12 at 09:17) RafalChmiel RafalChmiel's gravatar image

Would it be something like "Url = My.Computer.FileSystem.ReadAllText(Url)" and "Content = Url"? Thanks.

(May 19 '12 at 09:19) RafalChmiel RafalChmiel's gravatar image

Ah, no that would be a whole different kettle of fish. Have a read of this http://www.ozzu.com/programming-forum/can-read-remote-file-t57410.html

(May 19 '12 at 09:28) Cornelia Cornflake Cornelia%20Cornflake's gravatar image

I solved it in another way but thanks anyway.

(May 19 '12 at 10:15) RafalChmiel RafalChmiel's gravatar image

This is the code I used if anyone is interested:

Function GetCSV(ByVal Url)

        Dim Content
        Dim OutputFile

        Try

            Dim _WebClient As WebClient = New WebClient
            Dim _Response As Stream = _WebClient.OpenRead(Url)
            Dim _StreamReader As New IO.StreamReader(_Response)

            Content = _StreamReader.ReadToEnd()
            _StreamReader.Close()

        Catch ex As Exception
            Return ex
        End Try

        Content = Replace(Content, "Date,Open,High,Low,Close,Volume,Adj Close", "")
        Content = Trim(Content)
        OutputFile = Content

        Return OutputFile

End Function

answered May 19 '12 at 10:16

RafalChmiel's gravatar image

RafalChmiel
491141151156

edited May 19 '12 at 10:17

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported


Join Us in the Chat Room

Tags:

×410
×314
×275
×268
×117
×98
×60
×22
×11
×6
×2

Asked: May 19 '12 at 09:04

Seen: 9,040 times

Last updated: May 19 '12 at 10:17