12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- /**
- * Created by PhpStorm.
- * User: TianFeng
- * Date: 2019-03-18
- * Time: 15:38
- */
- namespace Home\Controller;
- use Think\Controller;
- include '../Common/function.php';
- class ScanPushController extends ComController {
- public function scan_push(){
- $ercode=I('post.data');
- $phone=$_SESSION['phone'];
- $log = "[时间".date("Y-m-d H:i:s")."]".$ercode."-----------".$phone."\r\n";
- $filename_log = "/var/www/html/jdxf/log/saoma".date("Y-m-d").".log";
- file_put_contents($filename_log, $log, FILE_APPEND|LOCK_EX);
- if(empty($phone)){
- echo 1;
- exit();
- }
- if(empty($ercode)){
- echo 1;
- exit();
- }
- // $data=array(
- // 'action'=>'wxercode',
- // 'phone'=>$phone,
- // 'ercode'=>$ercode,
- // );
- $data="{\"action\":\"wxercode\",\"phone\":\"".$phone."\",\"ercode\":\"".$ercode."\"}";
- $url='http://101.133.214.75:55125/report';
- // $url='http://39.98.37.17:8080/YtIoT/iot/admin/test';
- // $postData = http_build_query($data);
- // $curl = curl_init();
- // curl_setopt($curl, CURLOPT_URL, $url);
- // curl_setopt($curl, CURLOPT_USERAGENT,'Opera/9.80 (Windows NT 6.2; Win64; x64) Presto/2.12.388 Version/12.15');
- // curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate
- // curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- // curl_setopt($curl, CURLOPT_POST, true);
- // curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
- // curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
- // curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
- // $result = curl_exec($curl);
- // curl_close($curl);
- $result = http_post_advertise($url,$data);
- $log = "[时间".date("Y-m-d H:i:s")."]".$result."\r\n";
- $filename_log = "/var/www/html/jdxf/log/ceshi".date("Y-m-d").".log";
- file_put_contents($filename_log, $log, FILE_APPEND|LOCK_EX);
- if ($result['action']=='wxercode'&&$result['result']=='1'){
- echo 2;
- }else{
- echo 1;
- }
- }
- // public function post_a(){
- //// $data=I();
- // $data = input('');
- //
- //// if (empty($data)){
- //// $data='空值';
- //// }
- // print_r("INSERT INTO a_ceshi ( data ) VALUES ( '".$data."' )");
- // addInt("INSERT INTO a_ceshi ( data ) VALUES ( '".$data."' )");
- // }
- }
|