[TUT]Writing into an online file 02-21-2011, 10:43 PM
#1
Hi 
Don't know how to call it in other words
sorry 
you can post suggestions
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:
Credits go to some unknown person 
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
Now, lets start the code.
So, first we have to make a webclient, so we will do:
You will get error, so add:
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:
after the: "data=" you put in whatever you want 
Now, to make this work, we have to do this:
This will send a command to print "Hello World" into the log file
Now to make it work, close the code with:
if you don't want the text anymore, use:
Thats all folks
Have a great day!

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

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);
}
?>
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

Now, lets start the code.
So, first we have to make a webclient, so we will do:
Code:
Dim wc As New WebClientYou will get error, so add:
Code:
Imports System.NetNow 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=
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

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

Have a great day!
Staff will never ever ask you for your personal information.
We know everything about you anyway.
We know everything about you anyway.
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)

![[Image: rytwG00.png]](http://i.imgur.com/rytwG00.png)