Station A registers Station B with the url-based POST data. psot Chinese characters are garbled on site B. directly paste the code: $ name & quot; Huang Feihong & quot ;; $ password & quot; 123456 & quot; $ get_url & quot; www. xxx. comreg. php? Name & quot;. $ name. & quot; & amp; password & quot;. $ password $ rowgetToken ($ get_url); $ objjson_decode ($ row); func phpcurl garbled
Station A registers Station B with POST data in url form. psot Chinese characters are garbled on site B;
Direct code:
$ Name = "Huang Feihong ";
$ Password = "123456 ";
$ Get_url = "http://www.xxx.com/reg.php? Name = ". $ name." & password = ". $ password
$ Row = getToken ($ get_url );
$ Obj = json_decode ($ row );
Function getToken ($ url ){
$ Ch = curl_init ();
$ This_header = array ("content-type: application/x-www-form-urlencoded; charset = UTF-8 ");
Curl_setopt ($ ch, CURLOPT_HTTPHEADER, $ this_header );
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
Return curl_exec ($ ch );
}
The name received by the recipient is garbled; as a result, the registration fails.
Thank you ~