Phpcurl simulates small instances of post requests. Local Machine: Copy the code as follows :? Php $ uriwww. a. comtest. php; replace it with the address parameter array of your server $ dataarray (nametantengpassword local machine:
The code is as follows:
$ Uri = "http://www.a.com/test.php"; // Here is the address of your server
// Parameter array
$ Data = array (
'Name' => 'tanteng'
// 'Password' => 'password'
);
$ Ch = curl_init ();
// Print_r ($ ch );
Curl_setopt ($ ch, CURLOPT_URL, $ uri );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ data );
$ Return = curl_exec ($ ch );
Curl_close ($ ch );
Print_r ($ return );
Remote server:
The code is as follows:
If (isset ($ _ POST ['name']) {
If (! Empty ($ _ POST ['name']) {
Echo 'hello, ', $ _ POST ['name'].'! ';
}
}
The pipeline code is as follows :? Php $ uri = "http://www.a.com/test.php "; // replace it with the address of your server. // The parameter array $ data = array ('name' = 'tanteng' // 'password' = '...