PHP code
First, PHP
<?php
Header ("Content-type:text/html;charset=utf-8");
$u =$_post[' zdupdate '];
$p =$_post[' pid '];
$a =$_post["Afid"];
$d =$_post["Dtime"];
Require ('.. /db/conn.php ');//Open file
$sql _expire= "insert INTO ' M-haibook '. Tbl_aff_log (Aff_id,p_id,log_date,create_date) VALUES ($a, $p, ' $d ', Now ()) ";
if ($u = = ' Y ')
{
$myconn = mysql_connect ($server _name, $db _username, $db _password);
mysql_select_db ($db _name);
mysql_query ("Set names ' UTF8 '");
mysql_query ($sql _expire);
Print "1HHhh ... 1154QQwweeWW ";
}
? >
Second, C # code
String poststring = "zdupdate=y&pid=" + dt. rows[i]["Pid". ToString () + "&afid=" + dt. rows[i]["Affiateid"]. ToString () + "&dtime=" + dt. rows[i]["Dtime"]. ToString () + "";//Here is the passed parameter, can be used to grasp the package analysis, can also analyze their own, mainly in the form inside every name should be added
byte[] postdata = Encoding.UTF8.GetBytes ( poststring)//encoding, especially Chinese characters, in advance to see the encoding of the crawl page
string url = "http://haibook.pnxchina.com/api/index.php";//Address
WebClient WebClient = new WebClient ();
WEBCLIENT.HEADERS.ADD ("Content-type", "application/x-www-form-urlencoded");/the header that must be added to the Post method, If you change to get way, then remove this sentence can
byte[] responsedata = webclient.uploaddata (URL, "POST", postdata);/Gets the return character stream
The above is a small set to introduce C # for you to open the PHP link and then receive the return value of the key code, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!