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


PHP curl_get_contents函数代码示例

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


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

示例1: getChampionRoles

function getChampionRoles()
{
    // get the basic summoner info
    $result = 'http://127.0.0.1:8081/LeagueOfLegendsServer/ChampionList.json';
    $summoner = curl_get_contents($result);
    echo $summoner;
}
开发者ID:Skyman12,项目名称:LeagueOfLegendsServer,代码行数:7,代码来源:simpleserver.php

示例2: getVideoDetails

 function getVideoDetails($video_id = '')
 {
     $error = '';
     //check for a cached file
     $cachedFileName = './system/cache/youtubexml_' . $video_id;
     $url = "http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id={$this->dev_id}&video_id={$video_id}";
     #TODO check if file past cache limit
     if (file_exists($cachedFileName)) {
         $resultObj = simplexml_load_file($cachedFileName);
     } else {
         $contents = curl_get_contents($url);
         $resultObj = simplexml_load_string($contents);
         //if we want to cache the data write the data to a file
         if ($this->cacheData) {
             // delete the file if it already exists
             if (file_exists($cachedFileName)) {
                 unlink($cachedFileName);
             }
             // recreate file and recache data
             if ($file = fopen($cachedFileName, 'wb')) {
                 fwrite($file, $contents);
                 fclose($file);
             }
         }
     }
     return $resultObj;
 }
开发者ID:holsinger,项目名称:openfloor,代码行数:27,代码来源:YouTubeApi.php

示例3: new_access_token

function new_access_token($db)
{
    $time = time();
    $ret = $db->getRow("SELECT * FROM `wxch_config` WHERE `id` = 1");
    $appid = $ret['appid'];
    //AppId 18
    $appsecret = $ret['appsecret'];
    //AppSecret 32
    $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
    if (function_exists(curl_exec)) {
        $ret_json = curl_get_contents($url);
        //access_token 150
    } else {
        echo '您的服务器不支持:curl_exec函数';
        exit;
    }
    $ret = json_decode($ret_json);
    //        $db->query("UPDATE `wxch_config` SET `access_token` = '',`dateline` = '$time' WHERE `id` =1;");
    if ($ret->access_token) {
        $db->query("UPDATE `wxch_config` SET `access_token` = '{$ret->access_token}',`dateline` = '{$time}' WHERE `id` =1;");
        return $ret->access_token;
    } else {
        return false;
    }
}
开发者ID:will0306,项目名称:bianli100,代码行数:25,代码来源:qr_affiliate.php

示例4: notifications_crond

 public function notifications_crond()
 {
     $last_version = json_decode(curl_get_contents('http://wenda.wecenter.com/api/version_check.php'), true);
     $admin_notifications = get_setting('admin_notifications');
     $notifications = array('answer_approval' => $this->count('approval', "type = 'answer'"), 'question_approval' => $this->count('approval', "type = 'question'"), 'article_approval' => $this->count('approval', "type = 'article'"), 'article_comment_approval' => $this->count('approval', "type = 'article_comment'"), 'weibo_msg_approval' => $this->count('weibo_msg', 'question_id IS NULL'), 'received_email_approval' => $this->count('received_email', 'question_id IS NULL'), 'unverified_modify_count' => $this->count('question', 'unverified_modify_count <> 0'), 'user_report' => $this->count('report', 'status = 0'), 'register_approval' => $this->count('users', 'group_id = 3'), 'verify_approval' => $this->count('verify_apply', 'status = 0'), 'last_version' => array('version' => $last_version['version'], 'build_day' => $last_version['build_day']), 'sina_users' => $admin_notifications['sina_users'], 'receive_email_error' => $admin_notifications['receive_email_error']);
     $this->model('setting')->set_vars(array('admin_notifications' => $notifications));
 }
开发者ID:chenruixuan,项目名称:wecenter,代码行数:7,代码来源:admin.php

示例5: access_token

function access_token($db)
{
    $ret = $db->getRow("SELECT * FROM `wxch_config` WHERE `id` = 1");
    $appid = $ret['appid'];
    $appsecret = $ret['appsecret'];
    $access_token = $ret['access_token'];
    $dateline = $ret['dateline'];
    $time = time();
    if ($time - $dateline >= 7200) {
        $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
        $ret_json = curl_get_contents($url);
        $ret = json_decode($ret_json);
        if ($ret->access_token) {
            $db->query("UPDATE `wxch_config` SET `access_token` = '{$ret->access_token}',`dateline` = '{$time}' WHERE `id` =1;");
            return $ret->access_token;
        }
    } elseif (empty($access_token)) {
        $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
        $ret_json = curl_get_contents($url);
        $ret = json_decode($ret_json);
        if ($ret->access_token) {
            $db->query("UPDATE `wxch_config` SET `access_token` = '{$ret->access_token}',`dateline` = '{$time}' WHERE `id` =1;");
            return $ret->access_token;
        }
    } else {
        return $access_token;
    }
}
开发者ID:seanguo166,项目名称:microdistribution,代码行数:28,代码来源:wxch_share.php

示例6: add

 static function add($request)
 {
     //Send any parameters that the worker needs.
     $request = http_build_query(compact('request'), '&amp');
     $url = self::$path_to_worker . "?{$request}";
     curl_get_contents($url, false, true);
 }
开发者ID:mehulsbhatt,项目名称:long_running_script,代码行数:7,代码来源:queue_manager.php

示例7: remote_get_contents

 function remote_get_contents($url)
 {
     if (function_exists('curl_get_contents') and function_exists('curl_init')) {
         return curl_get_contents($url);
     } else {
         return file_get_contents($url);
     }
 }
开发者ID:timclifford,项目名称:freelance-manager,代码行数:8,代码来源:install.php

示例8: remote_get_contents

function remote_get_contents($url)
{
    if (function_exists('curl_get_contents') and function_exists('curl_init')) {
        return curl_get_contents($url);
    } else {
        // A litte slower, but (usually) gets the job done
        return file_get_contents($url);
    }
}
开发者ID:andrescardenas,项目名称:ObSE,代码行数:9,代码来源:verificar_correo.php

示例9: id_by_token

function id_by_token($token)
{
    $graph = curl_get_contents('https://graph.facebook.com/me?fields=id&access_token=' . $token);
    //echo $graph;
    $json = json_decode($graph, true);
    if (array_key_exists('id', $json)) {
        return $json['id'];
    }
    return NULL;
}
开发者ID:BParksArchive,项目名称:VotingSimServer,代码行数:10,代码来源:helpers_cla.php

示例10: notifications_crond

 public function notifications_crond()
 {
     $last_version = json_decode(curl_get_contents('http://wenda.HeavenSpree.com/api/version_check.php'), true);
     $admin_notifications = AWS_APP::cache()->get('admin_notifications');
     if (!$admin_notifications) {
         $admin_notifications = get_setting('admin_notifications');
     }
     $admin_notifications = array('answer_approval' => $this->count('approval', 'type = "answer"'), 'question_approval' => $this->count('approval', 'type = "question"'), 'article_approval' => $this->count('approval', 'type = "article"'), 'article_comment_approval' => $this->count('approval', 'type = "article_comment"'), 'weibo_msg_approval' => $this->count('weibo_msg', 'question_id IS NULL'), 'received_email_approval' => $this->count('received_email', 'question_id IS NULL'), 'unverified_modify_count' => $this->count('question', 'unverified_modify_count <> 0'), 'user_report' => $this->count('report', 'status = 0'), 'register_approval' => $this->count('users', 'group_id = 3'), 'verify_approval' => $this->count('verify_apply', 'status = 0'), 'last_version' => array('version' => $last_version['version'], 'build_day' => $last_version['build_day']), 'sina_users' => $admin_notifications['sina_users'], 'receive_email_error' => $admin_notifications['receive_email_error']);
     AWS_APP::cache()->set('admin_notifications', $admin_notifications, 1800);
     return $this->model('setting')->set_vars(array('admin_notifications' => $admin_notifications));
 }
开发者ID:Vizards,项目名称:HeavenSpree,代码行数:11,代码来源:admin.php

示例11: GetProfile

 public static function GetProfile($email)
 {
     try {
         $profile = unserialize(curl_get_contents('http://www.gravatar.com/' . self::GetHash($email) . '.php'));
     } catch (Exception $e) {
         return FALSE;
     }
     if (!is_array($profile) || !isset($profile['entry'])) {
         return FALSE;
     }
     return $profile;
 }
开发者ID:OptimalInternet,项目名称:uCore,代码行数:12,代码来源:gravatar.php

示例12: ifrget

function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    if ($f) {
        $f = str_replace(array("\n", "\r"), ' ', $f);
        $r = explode(' ', $f);
        foreach ($r as $v) {
            $d = curl_get_contents($v);
            if (is_image($v) && $d) {
                $ret .= ifrim($v, $d);
            }
        }
    }
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:15,代码来源:ifrm.php

示例13: bookdescription

function bookdescription($getbookTitle)
{
    if (!empty($getbookTitle)) {
        $bookdesc = curl_get_contents('https://www.googleapis.com/books/v1/volumes?q=' . urlencode($getbookTitle));
        $len = 100;
        while ($len < 300 || $len > 4000) {
            preg_match("/\",\\s*\"description\":\\s*\"(.*)\",\\s*\"/Us", $bookdesc, $results);
            $bookdesc = preg_replace("/\",\\s*\"description\":\\s*\"(.*)\",\\s*\"/Us", '', $bookdesc, 1);
            $len = strlen($results[1]);
        }
        echo '<br>' . stripslashes($results[1]) . '<br>';
    } else {
        echo 'Invalid URL';
    }
}
开发者ID:jainendra,项目名称:kitaabghar,代码行数:15,代码来源:bookdetails.php

示例14: ifrget

function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    $f = http($f);
    if ($f) {
        $ret = curl_get_contents($f);
        if (is_image($f) && $ret) {
            $ret = ifrim($f, $ret);
        }
    }
    $encoding = embed_detect(strtolower($ret), "charset=", '"', "");
    if (strtolower($encoding) == "utf-8" or strpos($ret, 'é')) {
        $ret = utf8_decode_b($ret);
    }
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:16,代码来源:ifr.php

示例15: new_access_token

function new_access_token($db)
{
    $ret = $db->getRow("SELECT * FROM `wxch_config` WHERE `id` = 1");
    $appid = $ret['appid'];
    //AppId 18
    $appsecret = $ret['appsecret'];
    //AppSecret 32
    $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$appsecret}";
    $ret_json = curl_get_contents($url);
    //access_token 150
    $ret = json_decode($ret_json);
    if ($ret->access_token) {
        $db->query("UPDATE `wxch_config` SET `access_token` = '{$ret->access_token}',`dateline` = '{$time}' WHERE `id` =1;");
    }
    return $ret->access_token;
}
开发者ID:will0306,项目名称:bianli100,代码行数:16,代码来源:upload_media.php


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