Sinisterly
[TUT]Writing into an online file - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework)
+--- Thread: [TUT]Writing into an online file (/Thread-TUT-Writing-into-an-online-file)



[TUT]Writing into an online file - 1llusion - 02-21-2011

Hi Smile

Don't know how to call it in other words Biggrin sorry Smile
you can post suggestions Tongue

Ok, so today, I will teach you, how you can make a VB.NET app connect to the internet, and post some data there.

We will use:
=> a PHP file named index.php
=> a simple VB.NET code
=> a log.txt file. It doesn't have to contain anything

Setting up the web files:

First of all, make a new text document.

Write in the following code:
PHP Code:
<?php $action = $_GET['action']; $data = $_GET['data']; if ($action == "delete"){ unlink("log.txt"); $new = fopen("log.txt", 'a'); fclose($new); } if ($action == "write"){ $open = fopen("log.txt", 'a'); fwrite($open, $data."\n"); fclose($open); } ?>
Credits go to some unknown person Biggrin

Okay, save this as: index.php

Now make a new text document. Just name it: log.txt

upload these to a webhost. It can be free webhost Smile

Now, lets start the code.

So, first we have to make a webclient, so we will do:
Code:
Dim wc As New WebClient

You will get error, so add:
Code:
Imports System.Net
On the very top of your app

Now we will send the command to the php file.
As you can see, there are 2 commands: "write" and "delete", we will use "write" now.

So, the command will look like this:
Code:
http://yourhost.ext/index.php?action=write&data=
after the: "data=" you put in whatever you want Smile

Now, to make this work, we have to do this:
Code:
wc.DownloadString("http://yourhost.ext/index.php?action=write&data=Hello World!")

This will send a command to print "Hello World" into the log file Smile

Now to make it work, close the code with:
Code:
wc.Dispose()

if you don't want the text anymore, use:
Code:
wc.DownloadString("http://yourhost.ext/index.php?action=delete")

Thats all folks Smile
Have a great day!


RE: [TUT]Writing into an online file - Coder-san - 02-22-2011

Nice Tutorial. Smile


RE: [TUT]Writing into an online file - 1llusion - 02-22-2011

(02-22-2011, 07:48 AM)Coder-san Wrote: Nice Tutorial. Smile

Thanks Smile


RE: [TUT]Writing into an online file - 1234hotmaster - 02-22-2011

Great guide this can be the best way to transfer data without getting rev-engineered Smile


RE: [TUT]Writing into an online file - 1llusion - 02-22-2011

Well... not really Smile

anybody can catch the packets and ofc edit them, also since its a text file, everybody can see it... better would be to encrypt the data + use SQL database Smile


RE: [TUT]Writing into an online file - Snipa - 02-24-2011

great tutorial mate Smile


RE: [TUT]Writing into an online file - 1llusion - 02-24-2011

(02-24-2011, 11:17 PM)foudz32 Wrote: great tutorial mate Smile

Thanks Smile


RE: [TUT]Writing into an online file - ShadowV - 02-25-2011

Nice tut my friend:thumbs:


RE: [TUT]Writing into an online file - 1llusion - 02-26-2011

(02-25-2011, 12:59 PM)ShadowV Wrote: Nice tut my friend:thumbs:

Thanks Smile Happy you liked it Smile