Php curl _ PHP Tutorial

Source: Internet
Author: User
Php curl learning. Php curl learning fortunately, the CTO has written an example for me to write 3, namepeter, age67); $ dataAuthorize_check ($ data); print_r ($ data) after it is secretly saved ); exit php curl learning
Fortunately, the CTO has written an example for me, which will be followed after it is secretly saved.
  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;?>

Thanks, the CTO has written an example for me to write 3, name = peter, age = 67) according to this example. $ data = Authorize_check ($ data ); // print_r ($ data); exit...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.