Reputation: 51
The app I've created in visual studio gets its data from the users pc currently stores it in a text file uploads that to the server and this is how I get the data. I was wondering if there is a way to have it send that same data without using text files but some kind of TCP connection maybe straight into a mysql server using php? How would this be done?
Upvotes: 4
Views: 7150
Reputation: 107
Looking for a solution to a similar issue, I found Pragmateek's suggestion good. However, I used a variable WebBrowser and called the function Navigate passing as parameter the URL with the data I wanted to update on my database (hosted on a web server).
This is what I mean
Dim br As New WebBrowser
br.Navigate("http://yourwebsite/your-php-script.php?your_variable=" + the_data_you_want_to_send)
This is working well so far for me.. good luck!
Upvotes: 0
Reputation: 13374
You can write a simple PHP web-service, "uploaddata.php":
<?php
if (isset($_POST["data"]))
{
echo("Saved these data: " . $_POST["data"]);
}
else
{
echo "ERROR: No data!";
}
?>
And use it from your VB.Net using the WebClient:
Dim wc As New WebClient
wc.Headers("content-type") = "application/x-www-form-urlencoded"
Dim response As String = wc.UploadString("http://localhost/uploaddata.php", "data=123" & Environment.NewLine & "456" & Environment.NewLine & "789")
MessageBox.Show(response)
Result:
Saved these data: 123
456
789
Upvotes: 3