|
@@ -335,20 +335,41 @@ class Shop extends Start_Controller {
|
|
|
$post_data = '';
|
|
|
foreach($postfields as $key=>$value){
|
|
|
$post_data .="$key=".urlencode($value)."&";}
|
|
|
+
|
|
|
+
|
|
|
+ $url = 'http://39.100.97.180/smt.php';
|
|
|
$ch = curl_init();
|
|
|
- curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
- curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
- curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
- //指定post数据
|
|
|
- curl_setopt($ch, CURLOPT_POST, true);
|
|
|
- //添加变量
|
|
|
- curl_setopt($ch, CURLOPT_POSTFIELDS, substr($post_data,0,-1));
|
|
|
+ curl_setopt($ch,CURLOPT_URL,$url);
|
|
|
+ curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
|
|
|
+ curl_setopt($ch,CURLOPT_HEADER,0);
|
|
|
+ curl_setopt($ch,CURLOPT_POST, 1);
|
|
|
+ curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,600);
|
|
|
+ //设置post数据
|
|
|
+ $post = array();
|
|
|
+ $post['get_token_by_code'] = 1;
|
|
|
+ $post['code'] = $code;
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
|
|
|
$output = curl_exec($ch);
|
|
|
+ curl_close($ch);
|
|
|
+
|
|
|
+
|
|
|
+ // $ch = curl_init();
|
|
|
+ // curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
+ // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
+ // curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
+ // curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
+ // //指定post数据
|
|
|
+ // curl_setopt($ch, CURLOPT_POST, true);
|
|
|
+ // //添加变量
|
|
|
+ // curl_setopt($ch, CURLOPT_POSTFIELDS, substr($post_data,0,-1));
|
|
|
+ // $output = curl_exec($ch);
|
|
|
$output = json_decode($output,true);
|
|
|
print_r($output);
|
|
|
$this->shop->save(array('code'=>$output["access_token"],'codetime'=>substr($output["expire_time"],0,10)),$_GET['state']);
|
|
|
header('Location:http://'.$_SERVER['HTTP_HOST'].'/user/');exit;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|