4 Replies - 278 Views - Last Post: 11 October 2017 - 04:58 AM Rate Topic: -----

#1 Pirulax  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 08-January 17

Creating a POST to php with a file to receive a file

Posted 10 October 2017 - 09:02 AM

So, hello there. I was trying to make a program to compile my .lua scripts, but i didn't succeed, i searched for it, tried like 10 solutions, but no one from them worked. So, here is what i tried[Only the current one.]:
    Private Sub compileFile(luafile_path As String, full_path As String)
        Dim f As FileStream = System.IO.File.Create(full_path & "c")
        f.Write(PostData(System.IO.File.Open(full_path), "http://luac.mtasa.com/index.php"))

    End Sub

    Public Function PostData(ByRef data As String, ByRef url As String) As String
        Dim request As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)

        request.Method = "POST"
        request.ContentType = "application/x-www-form-urlencoded"

        Dim post_data As String = data

        request.ContentLength = post_data.Length

        Dim writer As New StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII)

        writer.Write(post_data)
        writer.Close()

        Dim stream As Stream = request.GetResponse().GetResponseStream()
        Dim reader As New StreamReader(stream)
        Dim response As String = String.Empty

        While Not ((response = reader.ReadLine()) = Nothing)
            response += reader.ReadLine()
        End While


        Return response
    End Function



As you noticed i tried to convert the file.Open to a string, but as you may expect i didn't succeed. Heres the API i need to use.

I need to receive a file from the POST, and I need to create a .luac file from it.
Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Creating a POST to php with a file to receive a file

#2 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6376
  • View blog
  • Posts: 25,763
  • Joined: 12-December 12

Re: Creating a POST to php with a file to receive a file

Posted 10 October 2017 - 12:25 PM

Please describe more clearly what should be going on. You are writing VB.NET to post a request that is processed by PHP, that is returned as a text file... that you need to compile as lua??! With such a variety you need to be especially clear in your description.
Was This Post Helpful? 0
  • +
  • -

#3 Pirulax  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 08-January 17

Re: Creating a POST to php with a file to receive a file

Posted 10 October 2017 - 12:56 PM

Okey, so. I need to post a LUA File to the php file, which will compile it to a .luac file. Do u understand now?
And i need to save the .luac file at the same dir where the .lua was.Take a look at the link i provided. [https://luac.mtasa.com/api/]
U can also do it with curl.exe, but i didnt succeed

This post has been edited by Pirulax: 10 October 2017 - 01:05 PM

Was This Post Helpful? 0
  • +
  • -

#4 Pirulax  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 08-January 17

Re: Creating a POST to php with a file to receive a file

Posted 10 October 2017 - 01:03 PM

And i need to save the .luac file at the same dir where the .lua was.Take a look at the link i provided. [https://luac.mtasa.com/api/]
U can also do it with curl.exe, but i didnt succeed
Was This Post Helpful? 0
  • +
  • -

#5 Pirulax  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 08-January 17

Re: Creating a POST to php with a file to receive a file

Posted 11 October 2017 - 04:58 AM

Solved.
Process.Start("cmd.exe", "/k curl.exe -s -e -v -o s_fall_core.luac s_fall_core.lua")

// Btw, if someone wants, then can solve the real problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1