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


PHP http_get函数代码示例

本文整理汇总了PHP中http_get函数的典型用法代码示例。如果您正苦于以下问题:PHP http_get函数的具体用法?PHP http_get怎么用?PHP http_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_paging

function get_paging($url)
{
    $result = http_get($url, $refer = "");
    $result = $result["FILE"];
    $result = json_decode($result, true);
    return $result;
}
开发者ID:peter279k,项目名称:store_photo,代码行数:7,代码来源:new_photo_detect.php

示例2: get_user_info

function get_user_info()
{
    $app_id = $_POST['app_id'];
    $ajax_response = array('msg' => '');
    if (!file_exists($app_id . '_access_token')) {
        $ajax_response['msg'] = 'access_token not exist';
        echo json_encode($ajax_response);
    }
    //获取关注者openid列表
    $url = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token=' . L($app_id . '_access_token') . '&next_openid=owogBtzPp97oFlUuhKTjPfO7jMq8';
    $ret_array = json_decode(http_get($url), true);
    $file_name = $app_id . '_user_openid_list';
    //write_array_to_file($file_name, $ret_array['data']['openid'], $file_name);
    $ret_array['next_openid'] = 'owogBt8P7Ik7X_toVjFx0pdbd7ds';
    while ($ret_array['next_openid'] != '') {
        $url = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token=' . L($app_id . '_access_token') . '&next_openid=' . $ret_array['next_openid'];
        $ret_array = json_decode(http_get($url), true);
        print_r($ret_array);
        die;
        write_array_to_file($file_name, $ret_array['data']['openid'], $file_name);
    }
    $ajax_response['msg'] = 'get user amount successful';
    $ajax_response['amount'] = $ret_array['total'];
    echo json_encode($ajax_response);
}
开发者ID:rollandlau,项目名称:wechat-official-account-extractor,代码行数:25,代码来源:wechat_function.php

示例3: weather_google_conditions

function weather_google_conditions($lat, $lon)
{
    $enc_lat = geo_utils_prepare_coordinate($lat);
    $enc_lon = geo_utils_prepare_coordinate($lon);
    $query = array('weather' => ",,,{$enc_lat},{$enc_lon}");
    $url = $GLOBALS['weather_google_endpoint'] . "?" . http_build_query($query);
    $rsp = http_get($url);
    if (!$rsp['ok']) {
        return $rsp;
    }
    libxml_use_internal_errors(true);
    $doc = new DOMDocument();
    $doc->loadXML($rsp['body']);
    $xpath = new DOMXpath($doc);
    $cond = $xpath->query("*/current_conditions");
    $current = array();
    foreach ($cond as $c) {
        foreach ($c->childNodes as $node) {
            $k = $node->nodeName;
            $v = $node->getAttribute("data");
            if ($k == 'icon') {
                continue;
            }
            $current[$k] = $v;
        }
        break;
    }
    if (!count($current)) {
        return not_okay("failed to parse conditions");
    }
    $rsp = array('latitude' => $lat, 'longitude' => $lon, 'timestamp' => time(), 'source' => 'google', 'conditions' => $current);
    return okay($rsp);
}
开发者ID:nilswalk,项目名称:privatesquare,代码行数:33,代码来源:lib_weather_google.php

示例4: enplacify_openstreetmap_get_place

function enplacify_openstreetmap_get_place($place_type, $place_id)
{
    $cache_key = "enplacify_openstreetmap_{$place_type}_{$place_id}";
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        return $cache['data'];
    }
    $url = "www.openstreetmap.org/api/0.6/" . urlencode($place_type) . "/" . urlencode($place_id);
    $rsp = http_get($url);
    if (!$rsp['ok']) {
        return $rsp;
    }
    $xml = new DOMDocument();
    $xml->preserveWhiteSpace = false;
    $ok = $xml->loadXML($rsp['body']);
    if (!$ok) {
        return array('ok' => 0, 'error' => 'XML parse error');
    }
    $ima = $xml->documentElement->firstChild;
    $lat = $ima->getAttribute('lat');
    $lon = $ima->getAttribute('lon');
    $tags = array();
    foreach ($ima->childNodes as $tag) {
        $key = $tag->getAttribute('k');
        $value = $tag->getAttribute('v');
        $tags[$key] = $value;
    }
    $tags['latitude'] = $lat;
    $tags['longitude'] = $lon;
    $rsp = array('ok' => 1);
    $rsp[$place_type] = $tags;
    cache_set($cache_key, $rsp);
    return $rsp;
}
开发者ID:netcon-source,项目名称:dotspotting,代码行数:34,代码来源:lib_enplacify_openstreetmap.php

示例5: enplacify_yelp_get_listing

function enplacify_yelp_get_listing($listing_id)
{
    $cache_key = "enplacify_yelp_listing_{$listing_id}";
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        return $cache['data'];
    }
    $url = "http://www.yelp.com/biz/" . urlencode($listing_id);
    $headers = array();
    $more = array('follow_redirects' => 1);
    $rsp = http_get($url, $headers, $more);
    if (!$rsp['ok']) {
        return $rsp;
    }
    $vcard_rsp = vcard_parse_html($rsp['body']);
    $graph_rsp = opengraph_parse_html($rsp['body']);
    if (!$vcard_rsp['ok'] && !$graph_rsp['ok']) {
        $rsp = array('ok' => 0, 'error' => 'Failed to parse listing');
    } else {
        $listing = array_merge($vcard_rsp['vcard'], $graph_rsp['graph']);
        $listing['id'] = $listing_id;
        $rsp = array('ok' => 1, 'listing' => $listing);
    }
    cache_set($cache_key, $rsp);
    return $rsp;
}
开发者ID:netcon-source,项目名称:dotspotting,代码行数:26,代码来源:lib_enplacify_yelp.php

示例6: enplacify_dopplr_get_place

function enplacify_dopplr_get_place($place_type, $place_id)
{
    $cache_key = "enplacify_dopplr_{$place_type}_{$place_id}";
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        return $cache['data'];
    }
    $url = "http://dplr.it/" . urlencode($place_type) . "/" . urlencode($place_id);
    $headers = array();
    $more = array('follow_redirects' => 1);
    $rsp = http_get($url, $headers, $more);
    if (!$rsp['ok']) {
        return $rsp;
    }
    # https://github.com/mncaudill/flickr-machinetag-geo/blob/master/src/parsers/dopplr.php
    if (preg_match('#pointLat:(-?\\d.*),#U', $rsp['body'], $m)) {
        $latitude = floatval($m[1]);
    }
    if (preg_match('#pointLng:(-?\\d.*),#U', $rsp['body'], $m)) {
        $longitude = floatval($m[1]);
    }
    if (!$latitude || !$longitude) {
        return array('ok' => 0, 'error' => 'failed to locate lat,lon data');
    }
    if (preg_match('#<title>(.*)\\|#U', $rsp['body'], $m)) {
        $name = trim($m[1]);
    }
    $place = array('latitude' => $latitude, 'longitude' => $longitude, 'url' => $url, 'name' => $name);
    $rsp = array('ok' => 1, 'place' => $place);
    cache_set($cache_key, $rsp);
    return $rsp;
}
开发者ID:netcon-source,项目名称:dotspotting,代码行数:32,代码来源:lib_enplacify_dopplr.php

示例7: sms_send

function sms_send($mobile, $message, &$err)
{
    global $conf;
    $arr = array('0' => '发送成功', '1' => '发送成功', '-1' => '账号未注册', '-2' => '其他错误', '-3' => '密码错误', '-4' => '手机号格式不对', '-5' => '余额不足', '-6' => '定时发送时间不是有效的时间格式', '-7' => '提交信息末尾未加签名,请添加中文企业签名【 】', '-8' => '发送内容需在1到500个字之间', '-9' => '发送号码为空');
    $message = urlencode(iconv('UTF-8', 'GBK', $message . '【' . $conf['sitename'] . '】'));
    // 单条接口
    $s = "http://inolink.com/WS/Send.aspx?CorpID=xxx&Pwd=xxx&Mobile={$mobile}&Content={$message}&Cell=&SendTime=";
    // 批量发送接口
    //$s = "http://inolink.com/WS/BatchSend.aspx?CorpID=TCLKxxx&Pwd=xxx&Mobile=$mobile&Content=$message&Cell=&SendTime=";
    $r = http_get($s, 10, 3);
    xn_log($s . ',return:' . $r, 'sms');
    if ($r === FALSE) {
        $err = '短信网关超时';
        return FALSE;
    }
    if (!isset($arr[$r])) {
        $err = '网关返回的数据有问题' . $r;
        return FALSE;
    }
    if ($r == '1' || $r == '0') {
        return TRUE;
    } else {
        $err = $arr[$r];
        return $r;
    }
}
开发者ID:xianyuxmu,项目名称:alinkagarden-xiuno,代码行数:26,代码来源:sms.func.php

示例8: authCode

 public function authCode()
 {
     while (!is_null($this->_last_fetch_captcha) and microtime(true) - $this->_last_fetch_captcha < 2) {
         usleep(1000);
     }
     $this->_last_fetch_captcha = microtime(true);
     // 1. 先輸入認證碼
     $url = 'http://lvr.land.moi.gov.tw/N11/ImageNumberN13';
     $response = http_get($url);
     $message = http_parse_message($response);
     if (!preg_match('#JSESSIONID=([^;]*);#', $message->headers['Set-Cookie'], $matches)) {
         throw new Exception("找不到 JSESSIONID");
     }
     $this->cookie = $matches[1];
     $tmpfp = tmpfile();
     fwrite($tmpfp, $message->body);
     $tmp_meta = stream_get_meta_data($tmpfp);
     $return_var = 0;
     system('jp2a ' . escapeshellarg($tmp_meta['uri']), $return_var);
     if ($return_var == 1) {
         // 不是圖片,就再試一次...
         return $this->authCode();
     }
     fclose($tmpfp);
     $code = readline("請輸入認證碼: ");
     // 2. 輸入認證碼
     $response = http_post_fields('http://lvr.land.moi.gov.tw/N11/login.action', array('command' => 'login', 'count' => 0, 'rand_code' => intval($code), 'in_type' => 'land'), array(), array('cookies' => array('JSESSIONID' => $this->cookie)));
     if (strpos(http_parse_message($response)->body, '驗證碼錯誤')) {
         error_log('驗證碼錯誤,重試一次');
         $this->authCode();
     }
 }
开发者ID:royc,项目名称:realprice,代码行数:32,代码来源:crawler.php

示例9: enplacify_chowhound_get_restaurant

function enplacify_chowhound_get_restaurant($restaurant_id)
{
    $cache_key = "enplacify_chowhound_restaurant_{$restaurant_id}";
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        return $cache['data'];
    }
    $url = "http://www.chow.com/restaurants/" . urlencode($restaurant_id);
    $headers = array();
    $more = array('follow_redirects' => 1);
    $rsp = http_get($url, $headers, $more);
    if (!$rsp['ok']) {
        return $rsp;
    }
    $vcard_rsp = vcard_parse_html($rsp['body']);
    $graph_rsp = opengraph_parse_html($rsp['body']);
    if (!$vcard_rsp['ok'] && !$graph_rsp['ok']) {
        $rsp = array('ok' => 0, 'error' => 'Failed to parse restaurant');
    } else {
        $restaurant = array_merge($vcard_rsp['vcard'], $graph_rsp['graph']);
        $restaurant['id'] = $restaurant_id;
        $rsp = array('ok' => 1, 'restaurant' => $restaurant);
    }
    cache_set($cache_key, $rsp);
    return $rsp;
}
开发者ID:netcon-source,项目名称:dotspotting,代码行数:26,代码来源:lib_enplacify_chowhound.php

示例10: httpGet

 private function httpGet($url)
 {
     $data = http_get($url, $target = "");
     $data = $data["FILE"];
     $data = json_decode($data, true);
     return $data;
 }
开发者ID:BeautyInfo,项目名称:beautyUniversity,代码行数:7,代码来源:analytic.php

示例11: getwxAuthUserInfo

 /**
  * 微信checkAuth
  */
 public function getwxAuthUserInfo()
 {
     $url = C('WxPayConf_pub.JS_API_CALL_URL');
     $redirect_uri = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxad259a42911fa598&redirect_uri=' . $url . '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect';
     if ($_GET['code']) {
         $_SESSION['code'] = $_GET['code'];
         $getAccess_tokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxad259a42911fa598&secret=039e5f26008ebdd5665a8656191ec9c2&code=" . $_GET['code'] . "&grant_type=authorization_code";
         $Access_tokenInfo = http_get($getAccess_tokenUrl);
         $json = json_decode($Access_tokenInfo, true);
         $getUseInfoUrl = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $json['access_token'] . "&openid=" . $json['openid'] . "&lang=zh_CN";
         $userInfo = http_get($getUseInfoUrl);
         $data = json_decode($userInfo, true);
         $userData = D('Mobile/Users')->getWxId($data['openid']);
         if ($userData) {
             session('WST_USER', $userData);
         } else {
             $arr = D('Mobile/Users')->wxAuthLogin($data);
             if ($arr['userId'] > 0) {
                 //注册成功
                 //加载用户信息
                 $user = D('Mobile/Users')->get($arr['userId']);
                 if (!empty($user)) {
                     session('WST_USER', $user);
                 }
             }
         }
     } else {
         echo "<script language=javascript>window.location.href='" . $redirect_uri . "'</script>";
     }
 }
开发者ID:wmk223,项目名称:demotp,代码行数:33,代码来源:BaseAction.class.php

示例12: enplacify_flickr_get_photo

function enplacify_flickr_get_photo($photo_id)
{
    if (!$GLOBALS['cfg']['flickr_apikey']) {
        return array('ok' => 0, 'error' => 'No Flickr API key');
    }
    $cache_key = "enplacify_flickr_photo_{$photo_id}";
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        return $cache['data'];
    }
    $url = "http://api.flickr.com/services/rest/?method=flickr.photos.getInfo";
    $url .= "&photo_id={$photo_id}";
    $url .= "&api_key={$GLOBALS['cfg']['flickr_apikey']}";
    $url .= "&format=json&nojsoncallback=1";
    $rsp = http_get($url);
    if (!$rsp['ok']) {
        return $rsp;
    }
    $json = json_decode($rsp['body'], "fuck off php");
    if ($json['stat'] != 'ok') {
        return array('ok' => 0, 'error' => 'Flickr API error');
    }
    $photo = $json['photo'];
    $rsp = array('ok' => 1, 'photo' => $json['photo']);
    cache_set($cache_key, $rsp);
    return $rsp;
}
开发者ID:netcon-source,项目名称:dotspotting,代码行数:27,代码来源:lib_enplacify_flickr.php

示例13: send

 /**
  * 
  * 发送通知的函数
  * @param 通知类型 $type(sms-短信 email-邮件 hi-HI)
  * @param 接受者列表 $receiver
  * @param 标题 $title
  * @param 内容 $content
  * @param TOKEN $token
  */
 public function send($type, $receiver, $title, $content, $token)
 {
     $errmsg = '{"errmsg":"token is invalid."}';
     $okmsg = '{"errmsg":"ok"}';
     if (!in_array($token, $this->CI->config->item("token_array"))) {
         return $errmsg;
     }
     if (self::NOTIFY_SMS == $type) {
         $req_str = "&receiver=" . $receiver . "&content=" . urlencode($title);
         $url = $this->CI->config->item("sms_url") . $req_str;
         http_get($url);
     } elseif (self::NOTIFY_EMAIL == $type) {
         $this->CI->load->library('email');
         $this->CI->email->from('liuxiaochun03@baidu.com', 'liuxiaochun03');
         $this->CI->email->to($this->get_emaillist($receiver));
         $this->CI->email->subject('[监控报警]' . $title);
         $this->CI->email->message($content);
         $this->CI->email->send();
     } elseif (self::NOTIFY_HI == $type) {
         $cmd = 'echo "custom_send_grp_msg maphibot@163.com mapapptest ' . $receiver . ' ' . $content . ' " | nc dbl-wise-vs-ios00.dbl01 14440';
         system($cmd);
     } else {
         return $errmsg;
     }
     return $okmsg;
 }
开发者ID:sdgdsffdsfff,项目名称:stplatform,代码行数:35,代码来源:Notifier.php

示例14: loginUser

 /**
  * Logs in a user.
  *
  * @param string $username
  * @param string $password
  * @return true if login is successful
  */
 public function loginUser($username, $password)
 {
     global $databaseURI;
     $databaseURL = "{$databaseURI}/user/user/{$username}";
     $user = http_get($databaseURL, false, $message);
     $user = json_decode($user, true);
     // check if user exists
     if ($message != "404" && empty($user) == false) {
         // create passwordhash with salt as suffix
         if (isset($user['failedLogins']) && time() - $user['failedLogins'] < 15) {
             $waitSeconds = 15 - (time() - $user['failedLogins']);
             return MakeNotification("error", "Die Anmeldung ist für {$waitSeconds} Sekunden gesperrt!!!");
         }
         if (isset($user['salt'])) {
             $password = $this->hashData('sha256', $password . $user['salt']);
             if (isset($user['password']) && $password == $user['password']) {
                 // save logged in uid
                 $_SESSION['UID'] = $user['id'];
                 $refresh = $this->refreshSession();
                 return $refresh;
             } else {
                 $userid = $user['id'];
                 $databaseURL = "{$databaseURI}/user/user/{$userid}/IncFailedLogin";
                 $user = http_get($databaseURL, false, $message);
             }
         }
     }
     return false;
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:36,代码来源:Authentication.php

示例15: get_queryvalue

 private function get_queryvalue($field, $start, $end, $qt)
 {
     $url = 'http://10.95.36.21:8080/DataCenter/test/Query?table=tb_bphpui_qt&field=' . $field . '&condition=colqt%3D%22' . $qt . '%22&start=' . urlencode($start) . '&end=' . urlencode($end);
     $data = http_get($url);
     $json_data = json_decode($data);
     return $json_data->data[0]->value == null ? 0 : $json_data->data[0]->value;
 }
开发者ID:sdgdsffdsfff,项目名称:stplatform,代码行数:7,代码来源:ExecuterBphpuiqtfail.php


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