当前位置: 首页>>代码示例>>PHP>>正文


PHP Http::fsockopenDownload方法代码示例

本文整理汇总了PHP中Http::fsockopenDownload方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::fsockopenDownload方法的具体用法?PHP Http::fsockopenDownload怎么用?PHP Http::fsockopenDownload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Http的用法示例。


在下文中一共展示了Http::fsockopenDownload方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $name = $this->keyword;
     $key = $this->key;
     if (!strpos($name, "你是") === false) {
         return "咳咳,我是只能微信机器人";
     }
     if ($name == "你叫什么" || $name == "你是谁") {
         return "咳咳,我是聪明与智慧并存的美女,人家刚交男朋友,你不可追我啦";
     } else {
         if ($name == "糗事") {
             $name = "笑话";
         }
     }
     //$str = "http://liaotian.404.cn/pgicms_api/api.php?key=free&server_key=" . base64_encode(C("server_key")) . "&server_topdomain=" . C("server_topdomain") . "&appid=0&msg=" . urlencode($name);
     $str = "http://www.tuling123.com/openapi/api?key={$key}&info={$name}";
     $json = Http::fsockopenDownload($str);
     if ($json == false) {
         $json = file_get_contents($str);
     }
     $json = json_decode($json, true);
     //$str = str_replace("菲菲", $this->my, str_replace("提示:", $this->my . "提醒您:", str_replace("{br}", "\n", $json["content"])));
     $str = $json['text'];
     return $str;
     //  可以自己加一些信息....
     //return $str . "\n[我是聊天机器人--" . $this->my . "]";
 }
开发者ID:hehekeke,项目名称:pigcms,代码行数:27,代码来源:chat.class.php

示例2: api_notice_increment

	function api_notice_increment($url,$data,$method='POST'){
		$ch = curl_init();
		$header = "Accept-Charset: utf-8";
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
		curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
		curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		$tmpInfo = curl_exec($ch);
		$errorno=curl_errno($ch);
		if ($errorno) {
			return Http::fsockopenDownload($url);
			return array('rt'=>false,'errorno'=>$errorno);
		}else{
			//$js=json_decode($tmpInfo,1);
			//return $js;
			return $tmpInfo;
		}
	}
开发者ID:kevicki,项目名称:pig,代码行数:25,代码来源:card.class.php

示例3: index

	public function index()
	{
		$name = $this->keyword;

		if (!(strpos($name, '你是') === false)) {
			return '咳咳,我是只能微信机器人';
		}

		if (($name == '你叫什么') || ($name == '你是谁')) {
			return '咳咳,我是聪明与智慧并存的美女,人家刚交男朋友,你不可追我啦';
		}
		else if ($name == '糗事') {
			$name = '笑话';
		}

		$str = 'http://liaotian.404.cn/pgicms_api/api.php?key=free&server_key=' . base64_encode(C('server_key')) . '&server_topdomain=' . C('server_topdomain') . '&appid=0&msg=' . urlencode($name);
		$json = Http::fsockopenDownload($str);

		if ($json == false) {
			$json = file_get_contents($str);
		}

		$json = json_decode($json, true);
		$str = str_replace('菲菲', $this->my, str_replace('提示:', $this->my . '提醒您:', str_replace('{br}', "\n", $json['content'])));
		return $str . '' . "\n" . '[我是聊天机器人--' . $this->my . ']';
	}
开发者ID:kevicki,项目名称:pig,代码行数:26,代码来源:chat.class.php

示例4: callbackLogin

 /**
  * 登录回调
  */
 public function callbackLogin($request_args)
 {
     $user = $this->_om->getUserInfo($request_args);
     $bind_user = $this->_checkBind($this->_type, $user['keyid']);
     if ($bind_user) {
         //已经绑定过则更新绑定信息 自动登录
         $this->_updateBindInfo($user);
         $user_info = M('user')->field('id,username')->where(array('id' => $bind_user['uid']))->find();
         //登录
         $this->_oauth_visitor()->assign_info($user_info);
         return U('user/index');
     } else {
         //处理用户名
         if (M('user')->where(array('username' => $user['keyname']))->count()) {
             $user['pin_user_name'] = $user['keyname'] . '_' . mt_rand(99, 9999);
         } else {
             $user['pin_user_name'] = $user['keyname'];
         }
         $user['pin_user_name'] = urlencode($user['pin_user_name']);
         $user['keyname'] = urlencode($user['keyname']);
         if ($user['keyavatar_big']) {
             //下载原始头像到本地临时储存  用日期文件夹分类  方便清理
             $user['temp_avatar'] = '';
             $avatar_temp_root = C('pin_attach_path') . 'avatar/temp/';
             $temp_dir = date('ymd', time()) . '/';
             $file_name = date('ymdhis' . mt_rand(1000, 9999)) . '.jpg';
             mkdir($avatar_temp_root . $temp_dir);
             $image_content = Http::fsockopenDownload($user['keyavatar_big']);
             file_put_contents($avatar_temp_root . $temp_dir . $file_name, $image_content);
             $user['temp_avatar'] = $temp_dir . $file_name;
         }
         $user['type'] = $this->_type;
         //把第三方的数据存到COOKIE
         cookie('user_bind_info', $user);
         return U('user/binding');
         //跳转到绑定注册页
     }
 }
开发者ID:kid2682,项目名称:SMZDM,代码行数:41,代码来源:oauth.class.php

示例5: gupiao

 function gupiao($name)
 {
     $name = array_merge($name);
     $url = "http://api2.sinaapp.com/search/stock/?appkey=0020130430&appsecert=fa6095e113cd28fd&reqtype=text&keyword=" . $name[0];
     $json = Http::fsockopenDownload($url);
     if ($json == false) {
         $json = file_get_contents($url);
     }
     $json = json_decode($json, true);
     $str = $json['text']['content'];
     return $str;
 }
开发者ID:dlpc,项目名称:wxshoppingmall,代码行数:12,代码来源:WeixinAction.class.php

示例6: chat

 private function chat($name)
 {
     $function = M('Function')->where(array('funname' => 'liaotian'))->find();
     if (!$function['status']) {
         return '';
     }
     $this->requestdata('textnum');
     $check = $this->user('connectnum');
     if ($check['connectnum'] != 1) {
         return C('connectout');
     }
     if (!(strpos($name, '你是') === FALSE)) {
         return '咳咳,我是智能微信机器人';
     }
     if ($name == "你叫什么" || $name == "你是谁") {
         return '咳咳,我是聪明与智慧并存的美女,主人你可以叫我' . $this->my . ',人家刚交男朋友,你不可追我啦';
     } elseif ($name == "你父母是谁" || $name == "你爸爸是谁" || $name == "你妈妈是谁") {
         return '主人,' . $this->my . '是您创造的,所以他们是我的父母,不过主人我属于你的';
     } elseif ($name == '糗事') {
         $name = '笑话';
     } elseif ($name == '网站' || $name == '官网' || $name == '网址' || $name == '3g网址') {
         return "【" . C('site_name') . "】\n" . C('site_name') . "\n【" . C('site_name') . "服务宗旨】\n化繁为简,让菜鸟也能使用强大的系统!";
     }
     $str = 'http://api.bd001.com/iMicms_com/api.php?key=free&appid=0&msg=' . urlencode($name);
     $json = Http::fsockopenDownload($str);
     if ($json == false) {
         $json = file_get_contents($str);
     }
     $json = json_decode($json, true);
     $str = str_replace('菲菲', $this->my, str_replace('提示:', $this->my . '提醒您:', str_replace('{br}', "\n", $json['content'])));
     return str_replace('mzxing_com', 'pigcms', $str);
 }
开发者ID:noikiy,项目名称:vsuninpay,代码行数:32,代码来源:WeixinAction.class.php

示例7: gupiao

	public function gupiao($name)
	{
		if ($this->_checkFunction('gupiao')) {
			$url = 'http://api2.sinaapp.com/search/stock/?appkey=0020130430&appsecert=fa6095e113cd28fd&reqtype=text&keyword=' . $name[1];
		$json = Http::fsockopenDownload($url);

		if ($json == false) {
			$json = file_get_contents($url);
		}

		$json = json_decode($json, true);
		$str = $json['text']['content'];
		return $str;
		}
		else {
			return $this->noreplyReturn();
		}
	}
开发者ID:kevicki,项目名称:pig,代码行数:18,代码来源:WeixinAction.class.php

示例8: callbackLogin

 /**
  * 登陆回调
  */
 public function callbackLogin($request_args)
 {
     $user = $this->_om->getUserInfo($request_args);
     $bind_user = $this->_checkBind($this->_type, $user['keyid']);
     if ($bind_user) {
         //已经绑定过则更新绑定信息 自动登陆
         $this->_updateBindInfo($user);
         $user_info = M('user')->field('id,username,sign_time,score,status')->where(array('id' => $bind_user['uid']))->find();
         if ($this->isOnline($user_info['id'])) {
             if ($user_info['status']) {
                 //检测是否有同一IP的记录,有更新,否则 添加
                 $online = M('Online');
                 $map = array();
                 $map['ip'] = get_client_ip();
                 $online_id = $online->where($map)->getField('id');
                 if (empty($online_id)) {
                     //插入在线用户表
                     $data = array();
                     $data['uid'] = $user_info['id'];
                     $data['account'] = $user_info['username'];
                     $data['username'] = $user_info['username'];
                     $data['lasttime'] = time();
                     $data['ip'] = get_client_ip();
                     $online->add($data);
                 } else {
                     //更新在线用户表
                     $data = array();
                     $data['uid'] = $user_info['id'];
                     $data['account'] = $user_info['username'];
                     $data['username'] = $user_info['username'];
                     $data['lasttime'] = time();
                     $online->where($map)->save($data);
                 }
             } else {
                 $is_error = true;
                 //帐号已经被锁定
                 session('user_info', null);
                 cookie('user_info', null);
             }
         }
         //登陆
         $this->_oauth_visitor()->assign_info($user_info);
         return U('index/index');
     } else {
         //处理用户名
         if (M('user')->where(array('username' => $user['keyname']))->count()) {
             $user['ftx_user_name'] = $user['keyname'] . '_' . mt_rand(99, 9999);
         } else {
             $user['ftx_user_name'] = $user['keyname'];
         }
         $username = $user['ftx_user_name'];
         $user['ftx_user_name'] = urlencode($user['ftx_user_name']);
         $user['keyname'] = urlencode($user['keyname']);
         if ($user['keyavatar_big']) {
             //下载原始头像到本地临时储存  用日期文件夹分类  方便清理
             $user['temp_avatar'] = '';
             $avatar_temp_root = C('ftx_attach_path') . 'avatar/temp/';
             $temp_dir = date('ymd', time()) . '/';
             $file_name = date('ymdhis' . mt_rand(1000, 9999)) . '.jpg';
             mkdir($avatar_temp_root . $temp_dir);
             $image_content = Http::fsockopenDownload($user['keyavatar_big']);
             file_put_contents($avatar_temp_root . $temp_dir . $file_name, $image_content);
             $user['temp_avatar'] = $temp_dir . $file_name;
         }
         $user['type'] = $this->_type;
         //连接用户中心
         $passport = new passport(C('ftx_integrate_code'));
         // $passport = $this->_user_server();
         //注册
         $passw = mt_rand(111111, 999999);
         $uid = $passport->register($username, $passw);
         !$uid && exit($passport->get_error());
         $bind_info = array('ftx_uid' => $uid, 'ftx_username' => $username, 'keyid' => $user['keyid'], 'bind_info' => $user['bind_info']);
         $this->bindByData($bind_info);
         $tag_arg = array('uid' => $uid, 'uname' => $username, 'action' => 'register');
         tag('register_end', $tag_arg);
         //邀请注册奖励
         $union_date = array('uid' => $uid, 'username' => $username);
         D('user')->union_reg($union_date);
         //登陆
         $this->visitor = new user_visitor();
         $this->visitor->login($uid);
         //登陆完成
         $tag_arg = array('uid' => $uid, 'uname' => $username, 'action' => 'login');
         tag('login_end', $tag_arg);
         //同步登陆
         $synlogin = $passport->synlogin($uid);
         //$this->success(L('register_successe').$synlogin.'您的密码为 '.$passw.'  ', U('user/index'));
         return U('index/index');
     }
 }
开发者ID:it114,项目名称:ttzhe800,代码行数:94,代码来源:oauth.class.php

示例9: _get_seller_id

 /**
  * 获取商品卖家ID
  */
 private function _get_seller_id($iid)
 {
     $result = array('type' => 'taobao', 'id' => 0);
     $page_content = Http::fsockopenDownload('http://item.taobao.com/item.htm?id=' . $iid);
     if (!$page_content) {
         //$page_content = Http::fsockopenDownload('http://detail.tmall.com/item.htm?id='.$iid);
         $page_content = file_get_contents('http://detail.tmall.com/item.htm?id=' . $iid);
         $result['type'] = 'tmall';
     }
     preg_match('|; userid=(\\d+);|', $page_content, $out);
     $result['id'] = $out[1];
     return $result;
 }
开发者ID:leamiko,项目名称:9k9,代码行数:16,代码来源:cmt_taobaoAction.class.php

示例10: nearest

 public function nearest($x, $y)
 {
     //
     $x = $this->x;
     $y = $this->y;
     $company_model = M('Company');
     $where = array('token' => $this->token);
     $companies = $company_model->where($where)->order('isbranch ASC,taxis ASC')->select();
     $ldistance = 0;
     $nearestCompany = array();
     $i = 1;
     $index = 0;
     $j = 0;
     if ($companies) {
         foreach ($companies as $c) {
             $furl = 'http://api.map.baidu.com/direction/v1?mode=walking&origin=' . $x . ',' . $y . '&destination=' . $c['latitude'] . ',' . $c['longitude'] . '&region=&output=json&ak=' . $this->apikey;
             $rt = Http::fsockopenDownload($furl);
             if ($rt == false) {
                 $json = file_get_contents($furl);
             }
             $rt = json_decode($json, true);
             echo $rt;
             if (is_array($rt)) {
                 //长度
                 $distance = $rt['result']['routes'][0]['distance'];
                 if ($ldistance == 0) {
                     $nearestCompany = $c;
                     $ldistance = $distance;
                     $index = 1;
                 } else {
                     if ($distance < $ldistance) {
                         $nearestCompany = $c;
                         $ldistance = $distance;
                         $index = $j + 1;
                     }
                 }
             } else {
             }
             $j++;
         }
         //
         $distanceStr = $this->_getDistance($ldistance);
         $imgUrl = 'http://api.map.baidu.com/staticimage?center=' . $nearestCompany['longitude'] . ',' . $nearestCompany['latitude'] . '&width=640&height=320&zoom=13&markers=' . $nearestCompany['longitude'] . ',' . $nearestCompany['latitude'];
         $return[] = array('最近的是' . $nearestCompany['name'] . ',大约' . $distanceStr, "回复“步行去" . $index . "”“坐公交" . $index . "”或“开车去" . $index . "”获取详细路线图", $imgUrl, C('site_url') . '/index.php?g=Wap&m=Company&a=map&companyid=' . $nearestCompany['id'] . '&token=' . $this->token);
         return array($return, 'news');
     } else {
         return array('还没配置公司信息呢,您稍等', 'text');
     }
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:49,代码来源:MapTestAction.class.php

示例11: collect

 public function collect()
 {
     $source = '';
     if (false === ($setting = F('advanced_setting'))) {
         $this->ajaxReturn(0, L('illegal_parameters'));
     }
     $p = $this->_get('p', 'intval', 1);
     if ($setting['times'] == 1) {
         $urs = 'tejiaListRec';
     } else {
         if ($setting['times'] == 2) {
             $urs = 'tomorrow_item_list';
         }
     }
     if (!$setting['pid']) {
         $url = 'http://tejia.taobao.com/' . $urs . '.htm?&promotionId=' . $setting['cid'] . '&p=' . $p;
     } else {
         $url = 'http://tejia.taobao.com/' . $urs . '.htm?&promotionId=' . $setting['pid'] . '&tagId=' . $setting['cid'] . '&p=' . $p;
     }
     if ($p == 1) {
         $totalcoll = 0;
     } else {
         $totalcoll = F('totalcoll');
     }
     $coll = 0;
     $source = Http::fsockopenDownload($url);
     if (!$source) {
         $source = file_get_contents($url);
     }
     $source = str_replace(array("&nbsp;", " ", " ", "\n"), "", $source);
     $source = iconv('GBK', 'UTF-8//IGNORE', $source);
     if (strpos($source, 'no-pro-box')) {
         $this->ajaxReturn(0, '该类目暂时没有特价商品');
     }
     if (strpos($source, 'result-non')) {
         $this->ajaxReturn(0, '该类目暂时没有特价商品');
     }
     $sources = get_word($source, 'class="filter-list-detail', '<\\/div>');
     if (preg_match_all('/<dl(.*?)<\\/dl>/s', $sources, $matchitem)) {
         for ($i = 0; $i < count($matchitem[1]); $i++) {
             $item = $matchitem[1][$i];
             $titlestr = get_word($item, '<ddclass="title">', '<\\/dd>');
             $title = get_word($titlestr, 'target="_blank">', '<\\/a>');
             $img = get_word($item, 'src="', '_210x210.jpg"');
             if (!$img) {
                 $img = get_word($item, 'data-ks-lazyload="', '_210x210.jpg"');
             }
             if (!strpos($img, 'ttp:')) {
                 $img = 'http:' . $img;
             }
             $iid = get_word($item, '\\?id=', '&f=');
             $price = get_word($item, '<del>', '<\\/del>');
             $zkprice = get_word($item, '<strong>', '<\\/strong>');
             $volume = get_word($item, '<em>', '<\\/em>');
             $nick = '';
             $ems = '1';
             $zekou = round($zkprice / $price, 4);
             if (date("G") < 10) {
                 $coupon_start_time = strtotime(date("Y-m-d H:i:s", mktime(10, 0, 0, date("m"), date("d"), date("Y"))));
                 $coupon_end_time = strtotime(date("Y-m-d H:i:s", mktime(23, 59, 59, date("m"), date("d"), date("Y"))));
             } else {
                 if ($setting['times'] == 2) {
                     $coupon_start_time = strtotime(date("Y-m-d H:i:s", mktime(10, 0, 0, date("m"), date("d") + 1, date("Y"))));
                     $coupon_end_time = strtotime(date("Y-m-d H:i:s", mktime(23, 59, 59, date("m"), date("d") + 1, date("Y"))));
                 } else {
                     $coupon_start_time = strtotime(date("Y-m-d H:i:s", mktime(10, 0, 0, date("m"), date("d"), date("Y"))));
                     $coupon_end_time = strtotime(date("Y-m-d H:i:s", mktime(23, 59, 59, date("m"), date("d"), date("Y"))));
                 }
             }
             $itemarray['shop_type'] = 'C';
             $itemarray['title'] = $title;
             $itemarray['pic_url'] = $img;
             $itemarray['num_iid'] = $iid;
             $itemarray['price'] = $price;
             $itemarray['coupon_price'] = $zkprice;
             $itemarray['volume'] = $volume;
             $itemarray['nick'] = $nick;
             $itemarray['ems'] = $ems;
             $itemarray['cate_id'] = $setting['cate_id'];
             $itemarray['coupon_rate'] = $zekou * 10000;
             $itemarray['coupon_start_time'] = $coupon_start_time;
             $itemarray['coupon_end_time'] = $coupon_end_time;
             if ($title && $img && $iid) {
                 $result['item_list'][] = $itemarray;
             }
         }
     }
     foreach ($result['item_list'] as $key => $val) {
         $res = $this->_ajax_tb_publish_insert($val);
         if ($res > 0) {
             $coll++;
         }
         $totalcoll++;
     }
     if (strpos($source, '<spanclass="page-next"')) {
         $this->ajaxReturn(0, '已经采集完成' . $p . '页,本次采集到' . $totalcoll . '件商品!请返回,谢谢');
     }
     F('totalcoll', $totalcoll);
     $this->assign('p', $p);
     $this->assign('coll', $coll);
//.........这里部分代码省略.........
开发者ID:lzstg,项目名称:guangchangwu_web,代码行数:101,代码来源:advancedAction.class.php

示例12: collect

 public function collect()
 {
     $source = '';
     if (false === ($setting = F('advanced_setting'))) {
         $this->ajaxReturn(0, L('illegal_parameters'));
     }
     $p = $this->_get('p', 'intval', 1);
     if (!$setting['pid']) {
         $url = 'http://te.tejia.taobao.com/tomorrow_item_list.htm?&promotionId=' . $setting['cid'] . '&p=' . $p . '#J_More';
     } else {
         $url = 'http://te.tejia.taobao.com/tomorrow_item_list.htm?&promotionId=' . $setting['pid'] . '&cid=' . $setting['cid'] . '&p=' . $p . '#J_More';
     }
     if ($p == 1) {
         $totalcoll = 0;
     } else {
         $totalcoll = F('totalcoll');
     }
     $coll = 0;
     $source = Http::fsockopenDownload($url);
     if (!$source) {
         $source = file_get_contents($url);
     }
     $source = rtrim(ltrim(trim($source), '('), ')');
     $source = iconv('GBK', 'UTF-8//IGNORE', $source);
     if (strpos($source, 'no-pro-box')) {
         $this->ajaxReturn(0, '该类目暂时没有特价商品');
     }
     $sources = get_word($source, '<div class="filter-list-detail"', '<!--page start-->');
     if (preg_match_all('/<li(.*?)<\\/li>/s', $sources, $matchitem)) {
         for ($i = 0; $i < count($matchitem[1]); $i++) {
             $item = $matchitem[1][$i];
             $titlehtml = get_word($item, '<dd class="title">', '<\\/dd>');
             $title = get_word($titlehtml, 'tejiaforenotice" target="_blank">', '<\\/a>');
             $img = get_word($item, 'src="', '_210x210.jpg');
             $iid = get_word($item, 'id=', '&');
             $price = get_word($item, '<dd><del>', '<\\/del>');
             $zkprice = get_word($item, '<dd><strong>', '<\\/strong>');
             $volume = 0;
             $nick = '';
             $ems = '1';
             $zekou = round($zkprice / $price, 4);
             if (date("G") < 9) {
                 $coupon_start_time = strtotime(date("Y-m-d H:i:s", mktime(10, 0, 0, date("m"), date("d"), date("Y"))));
                 $coupon_end_time = strtotime(date("Y-m-d H:i:s", mktime(23, 59, 59, date("m"), date("d"), date("Y"))));
             } else {
                 $coupon_start_time = strtotime(date("Y-m-d H:i:s", mktime(10, 0, 0, date("m"), date("d") + 1, date("Y"))));
                 $coupon_end_time = strtotime(date("Y-m-d H:i:s", mktime(8, 59, 59, date("m"), date("d") + 2, date("Y"))));
             }
             $itemarray['shop_type'] = 'C';
             $itemarray['title'] = $title;
             $itemarray['pic_url'] = $img;
             $itemarray['num_iid'] = $iid;
             $itemarray['price'] = $price;
             $itemarray['coupon_price'] = $zkprice;
             $itemarray['volume'] = $volume;
             $itemarray['nick'] = $nick;
             $itemarray['ems'] = $ems;
             $itemarray['cate_id'] = $setting['cate_id'];
             $itemarray['coupon_rate'] = $zekou * 10000;
             $itemarray['coupon_start_time'] = $coupon_start_time;
             $itemarray['coupon_end_time'] = $coupon_end_time;
             if ($title && $img && $iid) {
                 $result['item_list'][] = $itemarray;
             }
         }
     }
     foreach ($result['item_list'] as $key => $val) {
         $res = $this->_ajax_tb_publish_insert($val);
         if ($res > 0) {
             $coll++;
         }
         $totalcoll++;
     }
     if (strpos($source, '<span class="page-next"')) {
         $this->ajaxReturn(0, '已经采集完成' . $p . '页,本次采集到' . $totalcoll . '件商品!请返回,谢谢');
     }
     F('totalcoll', $totalcoll);
     $this->assign('p', $p);
     $this->assign('coll', $coll);
     $this->assign('totalnum', $totalnum);
     $this->assign('totalcoll', $totalcoll);
     $resp = $this->fetch('collect');
     $this->ajaxReturn(1, '', $resp);
 }
开发者ID:leamiko,项目名称:9k9,代码行数:84,代码来源:advancedAction.class.php

示例13: subscribe_handler

 /**
  * 关注
  * @access public
  * @param array $info 用户信息
  * @return void
  */
 function subscribe_handler($info)
 {
     $access_token = get_access_token();
     $openid = (string) $info['from'];
     $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$access_token}&openid={$openid}";
     $data = json_decode(file_get_contents($url), true);
     $count = D("Account")->where("openid='{$openid}'")->count();
     if ($count >= 1) {
         return false;
     }
     $data['time'] = time();
     $data['openid'] = $openid;
     $data['no'] = '61308818' . date('YmdHis') . rand(0, 9);
     $data['sum'] = $data['fill'] = $data['handsel'] = 0;
     $uid = D("Account")->add($data);
     import("ORG.Net.Http");
     $qrcode = qrcode(U("Admin/Account/show", array("id" => $uid), true, false, true));
     file_put_contents("./Public/qrcode/" . $data['no'] . '.jpg', Http::fsockopenDownload($qrcode));
     //Http::curlDownload($qrcode, './Public/qrcode/'.$data['no'].'.jpg');
 }
开发者ID:xibaachao,项目名称:1bz,代码行数:26,代码来源:ApiAction.class.php


注:本文中的Http::fsockopenDownload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。