Exemple #1
0
<?
include_once('simple_curl.php');
include_once('json.php');
$payload = "";
$page = "";
foreach ($_GET as $key=>$value) {
	if ($value == "") {
		$page = $key;	
	} else {
		$payload .= "$key=$value&";
	}
}
if (strlen($payload)) {
	$payload = substr($payload,0,-1);
}

print simple_post("omegle.com/$page",$payload);
?>
 /**
  * {
  * "touser":"******",
  * "msgtype":"text",
  * "text":
  * {
  * "content":"Hello World"
  * }
  * }
  */
 public function sendMessage($openid, $content = '', $msgtype = 'text')
 {
     $ACCESS_TOKEN = $this->getAccess();
     if ($msgtype == 'text') {
         $data['touser'] = $openid;
         $data['msgtype'] = "text";
         $data['text']["content"] = urlencode($content);
         $json = urldecode(json_encode($data));
         $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $ACCESS_TOKEN;
         $res = json_decode(simple_post($url, $json), true);
     }
     $Weixinsend = D('Weixinsend');
     $send['openid'] = $openid;
     $send['type'] = $msgtype;
     $send['content'] = $content;
     //echo date('Y-m-d h:i:s a') ;die();
     $send['CreateTime'] = current_timestamp();
     $Weixinsend->data($send)->add();
     return $res;
 }
 public function picAddHandle()
 {
     $config = array("savePath" => 'Weixin/', "maxSize" => 1000000, "exts" => array('jpg', 'gif', 'png', 'jpeg'), "subName" => array('date', 'Y/m-d'));
     $upload = new Upload($config);
     $info = $upload->upload();
     if (!$info) {
         // 上传错误提示错误信息
         $this->error($upload->getError());
     } else {
         // 上传成功 获取上传文件信息
         //   $file_path_full = Upload_PATH . $info['img']['savepath'] . $info['img']['savename'];
         $file_path_full = $info['img']['fullpath'];
         if (!defined('SAE_TMP_PATH')) {
             // 非SAE环境中
             $image = new \Think\Image();
             $image->open($file_path_full);
             $image->thumb(150, 150)->save($file_path_full);
             $img_url = "http://" . $_SERVER['SERVER_NAME'] . str_replace('index.php', '', __APP__) . $file_path_full;
         } else {
             // SAE环境中
             $img_url = $file_path_full;
         }
         $ACCESS_TOKEN = $this->getAccess();
         $post_data = array("media" => '@' . $file_path_full);
         $URL = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token={$ACCESS_TOKEN}&type=image";
         $res = json_decode(simple_post($URL, $post_data), true);
         $data['type'] = $res['type'];
         $data['mediaId'] = $res['media_id'];
         $data['picurl'] = $img_url;
         $res = D('Weixinre')->data($data)->add();
         if ($res) {
             $this->success('上传成功!', U('Weixin/Reply/index'));
         }
     }
 }