Hack Forums
[.NET] Send Logs To Web Host [VB.Net/PHP] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Send Logs To Web Host [VB.Net/PHP] (/showthread.php?tid=4723636)



Send Logs To Web Host [VB.Net/PHP] - Mon£y - Mar 9, 2015

Today I'm bringing you a tutorial on how to send information to a web host using PHP and VB.Net.

First of all, copy the PHP code below, save it as post.php and upload it to your web host.

Code
<?php
$msg = $_GET['w'] . "\n";
$msg .= ' ' . "\n";
$msg .= '######################################################################' . "\n";
$msg .= ' ' . "\n";
$logfile= 'data.txt';
$fp = fopen($logfile, "a");
fwrite($fp, $msg);
fclose($fp);
?>

This code basically gets the information that was sent with the reference 'w' and adds a line of characters so you can easily distinguish between different logs.

It then saves the data to a new text file called data.txt in the same directory as the PHP file.

Now the VB.Net side, open a new project and add a richtextbox and a button.
You'll need to import system.net to the project, you can do this by adding this code above the class declaration.

Code
Imports System.Net

Next, double click the button to enter the button click function, and add this code (You'll need to change 'LINK' to your domain, obviously):

Code
Dim request As WebRequest = WebRequest.Create("http://LINK/post.php?w=" & RichTextBox1.Text)

request.GetResponse()

It's as simple as that! No more sending logs to email, etc.


Here's a picture of the compiled project and the output.

[Image: 5eDCWds.png]


* - N3oNight - Mar 9, 2015

Very simple and sweet tutorial..
good work buddy..


* - Only3 - Mar 9, 2015

u know u can just
<? file_put_contents('data.txt', $_GET['w'], FILE_APPEND); ?>


* - Hiiro - Mar 9, 2015

(Mar 9, 2015 10:04 PM)Only3 Wrote:  u know u can just
<? file_put_contents('data.txt', $_GET['w'], FILE_APPEND); ?>
file_put_contents is a wrapper around fopen, etc anyway.