[VB.NET] Netload API - Get file link

Status
Not open for further replies.

wolfallen

Member
6
2012
0
0
Can anyone help me about how to use Netload API on VB.Net? I don't know how to use HttpWebRequest. Paid or free.



---------- Post added at 02:23 PM ---------- Previous post was at 11:16 AM ----------

PHP:
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim request As WebRequest = WebRequest.Create("http://api.netload.in/getserver.php")

        request.Method = "POST"

        Dim postData As String = "modus = file_upload, file = C:\Users\x\Desktop\sc.rar, auth = (Auth Code), user_id = (user no), user_password = (user pass)"

        Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)

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

        request.ContentLength = byteArray.Length

        Dim dataStream As Stream = request.GetRequestStream()

        dataStream.Write(byteArray, 0, byteArray.Length)

        dataStream.Close()

        Dim response As WebResponse = request.GetResponse()

        MsgBox(CType(response, HttpWebResponse).StatusDescription)

        dataStream = response.GetResponseStream()

        Dim reader As New StreamReader(dataStream)

        Dim responseFromServer As String = reader.ReadToEnd()

        MsgBox(responseFromServer)

        reader.Close()
        dataStream.Close()
        response.Close()
    End Sub
End Class

I'm getting this responses.

"http://upload1.netload.in/api.php, ttp://upload2.netload.in/api.php, ttp://upload3.netload.in/api.php, ... etc"

Help me about post data string.
 
9 comments
well, read it http://tools.ietf.org/html/rfc2388 and construct the post format properly,

sending data via "application/x-www-form-urlencoded" will not work or at least not considered standard for HTTP POST request that have raw binary data.

My English not good for this article. Please can you show me an example?

This issue very important to me. If you can help would be most grateful.

Thank you very much for your response.

Regards.
 
You're getting a list of the available upload servers. Choose one of them and append /upload.php?id=9 at the end. Then send the file upload/POST request to this address.
 
If I understand you are saying,

Change this line

PHP:
Dim request As WebRequest = WebRequest.Create("http://api.netload.in/getserver.php")


to

PHP:
Dim request As WebRequest = WebRequest.Create("http://upload1.netload.in/upload.php?id=9")


Right? Is it helpful?
 
Yes, exactly! But let your script take on of the results you get from getserver.php. Don't write it directly in your script.
 
As you said, the response is netload error page source code.

PHP:
...

<div id="Content_Container">
        <div id="InLine_Content_Container">

        
        <br/><div class="InPage_Error"><pre>&bull; Error #01: Upload failed or the file doesn't meet our
<a href="http://netload.in/index.php?id=13">Terms of Service</a>.</pre></div><br/></div></div>

...
Thank you very much for your response.

Regards.
 
ContentType or enctype should be multipart/form-data
Also include all other post fields of the form where the file upload field is located. Just have a closer look at the netload.in source code. Netload.in doesn't allow archive uploads with passwords (except you are sending the password too) or encrypted archives.
 
ContentType or enctype should be multipart/form-data
Also include all other post fields of the form where the file upload field is located. Just have a closer look at the netload.in source code. Netload.in doesn't allow archive uploads with passwords (except you are sending the password too) or encrypted archives.

Just ".rar", no password no compression. Actually I don't know how to use "multipart/form-data" and I think post data string has a mistake too.

Thank you very much for every posts and helps.

Regards.

-----------------------------------------------------------

http://www.wjunction.com/1359639-post19.htm

There is PHP codes for Netload API but I don't know PHP. If anyone know PHP, can you translate or convert to VB.NET for me? What should I do? As I said, paid or free. Doesn't matter. I just want to finish this project as soon as possible.

Sorry for bad English.
 
Last edited:
Status
Not open for further replies.
Back
Top