How to add custom properties to the request header
However, you need to add custom attributes in the request header. For example mimi=3322
How do you define this?
$mimi = MD5 (3322);
$h = Array ("mimi:{$mimi}");
curl_setopt ($ch, Curlopt_httpheader, $h);
$result = curl_exec ($ch);
Var_dump ($result);
Do you think so? But I test to test go, send the request can not find their own defined properties Oh!~!~
------to solve the idea----------------------
$url = ' http://www.example.com/server.php ';
$mimi = MD5 (3322);
$header = Array (
"Mimi:{$mimi}"
);
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_returntransfer, true);
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_httpheader, $header);
$response = curl_exec ($ch);
if ($error =curl_error ($ch)) {
Die ($error);
}
Curl_close ($ch);
Echo $response;
server.php
$data = isset ($_server[' Http_mimi ')? $_server[' Http_mimi ': ';
Echo $data;