-1

I know the title isn't very elaborate, but I have tried this multiple times (to figure out how) but I could never find out how to do so. I want to do stuff like upload a "paste" to pastebin.com, upload a picture to twitpic.com, upload a file to rapidshare.com, etcetera.

How would I do so? Thanks!

(Visual Basic 2010 Express | Windows 7 Ultimate)

Brydon McCluskey
  • 83
  • 1
  • 3
  • 12

2 Answers2

1

I conscious that Visual Basic 2010 express will have some way to interact with the server side. If you couldn't find you need to change the language.

To post in twitpic you need to use their API givne in the following URL.

http://twitpic.com/api.do

let's say

  <form action="http://twitpic.com/api/uploadAndPost">
<input name="media"></input> 
<input name="username"></input> 
<input name="password"></input> 
<input name="message"></input> 
</form>
Dinesh
  • 1,088
  • 4
  • 16
  • 28
0

It depends. You can just do a cross-domain form submission (set the action to a page on another domain), or you can do server-server communication, or you can use JSONP (JSON wrapped in a function call).

VB.NET code for a Pastebin submission is:

Dim req As HttpWebRequest = DirectCast(WebRequest.Create("http://pastebin.com/api_public.php"), HttpWebRequest)
req.ContentType = "application/x-www-form-urlencoded"
req.Method = "POST"
Dim postData As String = "paste_code=Simple Example"
Dim postBytes As Byte() = Encoding.UTF8.GetBytes(postData)
req.ContentLength = postBytes.Length
Dim reqStream As Stream = req.GetRequestStream()
reqStream.Write(postBytes, 0, postBytes.Length)
reqStream.Close()
Dim resp As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)
Dim respText As String = New StreamReader(resp.GetResponseStream(), Encoding.UTF8).ReadToEnd()

respText is the generated paste bin URL. This can obviously be improved. It's an initial demonstration.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
  • I'm sorry, but I'm really not that great at Visual Basic, I haven't coded in quite some time. Is this all I need to know, and I just need to look up some tutorials and snippets, or should I ask you for more information? – Brydon McCluskey Nov 11 '10 at 05:11
  • @Brydon, I do recommend you do some research. Then, add information to this question, or ask a more specific one. To start, are you using VB 6 or VB.NET? – Matthew Flaschen Nov 11 '10 at 05:13
  • I am using Visual Basic 2010 Express. – Brydon McCluskey Nov 11 '10 at 05:14