PHP Curl Learning
Fortunately, the CTO wrote me an example, and after it was saved, I wrote it.
3, name = Peter, age = 67); $data = Authorize_check ($data); Print_r ($data); exit; $data _string = $data; $token = Base64_encode (admin:1234); $ch = Curl_init (' http://localhost/demo/index.php/member/post '); curl_setopt ($ch, Curlopt_customrequest, POST); curl_setopt ($ch, Curlopt_postfields, $data _string); curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_httpheader, Array (' x-http-method-override:post ')); $result = curl_exec ($ch); Print_r ($result); exit; $httpcode = Curl_getinfo ($ch, Curlinfo_http_code); $contenttype = Curl_getinfo ($ch, Curlinfo_content_type); Print Status: $httpcode. ; Print Content-type: $contenttype. ; Print. $result. ;} function Authorize_check ($data) {if (Is_array ($data)) {$chdata = '; Ksort ($data);//var_dump ($data); Exit;foreach ($ Data as $key = = $val) {if ($key = = ' Contact ' | | $key = = ' condition ' | | $key = = ' from ') { Continue }if ($key== ' usersession ' && empty ($data [' usersession ')) {$data [' usersession ']= ';} if ($key! = ' Chdata ') {$chdata. = $key. ' = '. $val.,;}} $chdata =trim ($chdata,,); $chdata =md5 ($chdata. Jiamizifuchuan); $data [' chdata '] = $chdata; return $data;}} List ($username, $password) = Explode (': ', Base64_decode (substr (' Basic ywrtaw46mtizna== ', 6));//echo $username;? >
http://www.bkjia.com/PHPjc/1047181.html www.bkjia.com true http://www.bkjia.com/PHPjc/1047181.html techarticle php Curl Learning Fortunately, the CTO wrote me a sample that was secretly saved and then wrote 3, name = Peter, age = 67); $data = Authorize_check ($data); Print_r ($data); Exit ...