using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.IO; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create("http://localhost/m.php"); ASCIIEncoding encoding = new ASCIIEncoding(); string postData =textBox1.Text; byte[] data = encoding.GetBytes(postData); httpWReq.Method = "POST"; httpWReq.ContentLength = data.Length; using (Stream newStream = httpWReq.GetRequestStream()) { newStream.Write("postData"); } } } }
$con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("data", $con); $sql="INSERT INTO Persons (Name) VALUES ('$_POST[httpWReq]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?>
$sql="INSERT INTO Persons (Name) VALUES ('$_POST[httpWReq]')";
newStream.Write("postData");}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)