interfaceService.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: vowkin
  5. * Date: 2017/5/20
  6. * Time: 11:27
  7. */
  8. namespace app\common\service;
  9. class interfaceService
  10. {
  11. public static $errorInfo = null;
  12. /**
  13. * @param $url
  14. * @param string $param
  15. * @param bool $is_ssl 是否启用ssl请求
  16. * @return mixed
  17. */
  18. /**
  19. * 微信二维码接口
  20. * @param $content
  21. * @return string
  22. */
  23. public static function returnErWeiCode($content){
  24. $public_key = '-----BEGIN PUBLIC KEY-----
  25. MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkMateIwsasBD9NT2n5iUc2RM5
  26. jERDyComwLyOCn0XIBNW246j2yd/yhGXFFKLJ2R2wqGn7RON+tE7901eDkqsqAX9
  27. vFZ3zWBHUczWzwSS4htSS047XJOWk+cKuRwPHxX0hZwyUjBMLW7Ig2jDNGqI7MO2
  28. KgUvqZxoMrB4PQ7OfQIDAQAB
  29. -----END PUBLIC KEY-----';
  30. // $data = json_encode(['content'=>'http://www.baidu.com','level'=>'M','size'=>3]);
  31. // //echo $data;exit;
  32. // //公钥
  33. // $publicKey = openssl_pkey_get_public($public_key);
  34. // $encrypted = '';
  35. // foreach (str_split($data, 117) as $chunk) {
  36. // openssl_public_encrypt($chunk, $encryptData, $publicKey);
  37. // $encrypted .= $encryptData;
  38. // }
  39. // $data = base64_encode($encrypted);
  40. $data = json_encode(['ssl_ts'=>time(),'content'=>$content,'level'=>'L',"size"=>'12',"is_down"=>1]);
  41. $moniOpenssl = helperService::http_post('https://wechatapi.ahamu.cn/base/moniOpenssl',$data,true);
  42. //echo $data."\n";
  43. $data = urlencode($moniOpenssl);
  44. //$return = httpPost('https://wechatapi.ahamu.cn/Qrcode/QR',$data);
  45. return "https://wechatapi.ahamu.cn/Qrcode/QR?encrypted={$data}";
  46. }
  47. }