<?php require __DIR__ . '/vendor/autoload.php'; use \Curl\Curl; $curl = new Curl(); $account=$_GET['id']; $step=$_GET['walk']; $salt='8061FD';//sign计算盐 $timestamp = time(); $sign = md5($account . $salt . $timestamp); $host = "http://weixin.droi.com/health/phone/index.php/SendWechat/getWxOpenid"; $curl->post($host, array( 'accountId' => $account, 'timeStamp' => $timestamp, 'sign' => $sign )); if ($curl->error) { die('Error: ' . $curl->errorCode . ': ' . $curl->errorMessage . "\n"); } else { $rep = json_decode( $curl->response, true ); if( $rep['code']!==0 ) { die( 'getWxOpenid:'.$rep['messsage']."\n" ); } $openid=$rep['openid']; echo "WeChatOpenId: {$openid}\n"; } echo "</br>"; echo "</br>"; $timestamp = time(); $sign=md5($account.$salt.$step.$salt.$timestamp.$salt.$openid); $host = "http://weixin.droi.com/health/phone/index.php/SendWechat/stepSubmit"; $curl->post($host, array( 'accountId' => $account, 'jibuNuber'=>$step, 'timeStamp' => $timestamp, 'sign' => $sign )); if ($curl->error) { die('stepSubmit: ' . $curl->errorCode . ': ' . $curl->errorMessage . "\n"); } else { $rep = json_decode($curl->response,true); echo "stepSubmit: ".$rep['messsage']; } $curl->close();