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


PHP file_get_contents_curl函数代码示例

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


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

示例1: worksheetsToArray

function worksheetsToArray($id)
{
    $entries = array();
    $i = 1;
    while (true) {
        $url = 'https://spreadsheets.google.com/feeds/list/' . $id . '/' . $i . '/public/full?alt=json';
        $data = @json_decode(file_get_contents_curl($url), true);
        $starttag = substr($data['feed']['title']["\$t"], 0, strpos($data['feed']['title']["\$t"], " "));
        if (!isset($data['feed']['entry'])) {
            break;
        }
        foreach ($data['feed']['entry'] as $entryKey => $entry) {
            $data['feed']['entry'][$entryKey]['gsx$starttag']["\$t"] = $starttag;
        }
        $entries = array_merge($entries, $data['feed']['entry']);
        $i++;
    }
    return $entries;
}
开发者ID:NicoKnoll,项目名称:BLNFMCalSync,代码行数:19,代码来源:blnfmcalsync.php

示例2: html_no_comment

function html_no_comment($url)
{
    $url = _urlencode($url);
    // create HTML DOM
    $check_curl = _isCurl();
    if (!($html = file_get_html($url))) {
        if (!($html = str_get_html(file_get_contents_curl($url))) or !$check_curl) {
            return false;
        }
    }
    // remove all comment elements
    foreach ($html->find('comment') as $e) {
        $e->outertext = '';
    }
    $ret = $html->save();
    // clean up memory
    $html->clear();
    unset($html);
    return $ret;
}
开发者ID:anhyeuviolet,项目名称:feednews,代码行数:20,代码来源:admin.functions.php

示例3: getSteamNames

function getSteamNames($steamID)
{
    $steamUserNamesUrl = file_get_contents_curl("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=41AF33A7F00028D1E153D748597DEEF3&steamids=" . $steamID);
    $content = json_decode($steamUserNamesUrl, true);
    $pieces = explode(",%20", $steamID);
    if (count($pieces) > 99) {
        for ($x = 100; $x <= count($pieces) - 2; $x++) {
            if ($x >= count($pieces) - 2) {
                $steamfriendsExtended .= $pieces[$x];
            } else {
                $steamfriendsExtended .= $pieces[$x] . ',%20';
            }
        }
        $steamfriendsExtendedUrl = file_get_contents_curl("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=41AF33A7F00028D1E153D748597DEEF3&steamids=" . $steamfriendsExtended);
        $steamfriendsExtendedContent = json_decode($steamfriendsExtendedUrl, true);
        foreach ($steamfriendsExtendedContent['response']['players'] as $player) {
            array_push($content['response']['players'], $player);
        }
    }
    return $content['response']['players'];
}
开发者ID:LennartEdberg,项目名称:SteamPortal,代码行数:21,代码来源:userInfo.php

示例4: instagram_get_photos

function instagram_get_photos($username, $num = 5)
{
    //look for user id
    $requser = "https://api.instagram.com/v1/users/search?q=" . $username . "&client_id=" . INSTAGRAM_KEY;
    $res = file_get_contents_curl($requser);
    $user_data = json_decode($res);
    $user_id = 0;
    //print_r($user_data);
    foreach ($user_data->data as $user) {
        if ($user->username == $username) {
            $user_id = $user->id;
            break;
        }
    }
    if ($user_id == 0) {
        return false;
    }
    //and now get the pictures
    $uri = "https://api.instagram.com/v1/users/" . $user_id . "/media/recent?count=" . $num . "&client_id=" . INSTAGRAM_KEY;
    $res = file_get_contents_curl($uri);
    $content = json_decode($res);
    return $content;
}
开发者ID:danieljulia,项目名称:backend_wp_plugin_instagram,代码行数:23,代码来源:instagram-api.php

示例5: fn_sb_movie_infobox_cache

function fn_sb_movie_infobox_cache($id, $detailType)
{
    //    $cacheage = get_option('imdbcacheage', -1);
    $cacheage = -1;
    $imageCacheDir = SB_CACHE_DIR . "/" . $id . ".jpg";
    $imageCacheUrl = SB_CACHE_URL . "/" . $id . ".jpg";
    $jsonCacheDir = SB_CACHE_DIR . "/" . $id . ".json";
    if (!file_exists($imageCacheDir) || $cacheage > -1 && filemtime($imageCacheDir) < time() - $cacheage || !file_exists($jsonCacheDir) || $cacheage > -1 && filemtime($jsonCacheDir) < time() - $cacheage) {
        //$url = "http://www.omdbapi.com/?i=".$movieid."&plot=short&r=json";
        $url = "http://www.omdbapi.com/?i={$id}&plot={$detailType}&r=json";
        $http_args = array('user-agent' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
        $rawResponse = wp_remote_request($url, $http_args);
        $rawResponse = $rawResponse['body'];
        //        $raw = file_get_contents_curl('http://www.omdbapi.com/?i=' . $id."&plot=short&r=json");
        $json = json_decode($rawResponse, true);
        $jsonResult = file_put_contents($jsonCacheDir, $rawResponse);
        //        echo("jsonResult". $jsonResult . "<br/>");
        $img = file_get_contents_curl($json['Poster']);
        $jsonResult = file_put_contents($imageCacheDir, $img);
        $json['Poster'] = $imageCacheUrl;
    } else {
        $rawResponse = file_get_contents($jsonCacheDir);
        $json = json_decode($rawResponse, true);
        $json['Poster'] = $imageCacheUrl;
    }
    return $json;
}
开发者ID:ScriptonBasestar,项目名称:sb-review-infobox,代码行数:27,代码来源:shortcodes-imdb.php

示例6: method

 /**
  * Делает запрос к Api VK
  * @param $method
  * @param $params
  */
 public function method($method, $params = null)
 {
     $p = "";
     if ($params && is_array($params)) {
         foreach ($params as $key => $param) {
             $p .= ($p == "" ? "" : "&") . $key . "=" . urlencode($param);
         }
     }
     /* $response = file_get_contents($this->url . $method . "?" . ($p ? $p . "&" : "") . "access_token=" . $this->access_token);
     
             if( $response ) {
                 return json_decode($response);
             } 
             return false;
         
     } */
     function file_get_contents_curl($url)
     {
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_HEADER, True);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         //Устанавливаем параметр, чтобы curl возвращал данные, вместо того, чтобы выводить их в браузер.
         curl_setopt($ch, CURLOPT_URL, $url);
         $data = curl_exec($ch);
         curl_close($ch);
         return $data;
     }
     $response = file_get_contents_curl($this->url . $method . "?" . ($p ? $p . "&" : "") . "access_token=" . $this->access_token);
     if ($response) {
         return json_decode($response);
     }
     return false;
 }
开发者ID:scalderdom,项目名称:overhead.in.ua,代码行数:38,代码来源:post.php

示例7: _request

 private function _request($request)
 {
     $request = array_map('Comet_encode', $request);
     array_unshift($request, $this->ORIGIN);
     $ctx = stream_context_create(array('http' => array('timeout' => 200)));
     return json_decode(file_get_contents_curl(implode('/', $request)), true);
 }
开发者ID:albertoneto,项目名称:localhost,代码行数:7,代码来源:comet.php

示例8: buildCSV

function buildCSV()
{
    $html = file_get_contents_curl(FACULTY_WEB);
    $matches;
    $table_regex = '/<td[^>]*>(.*?)<\\/td>/';
    preg_match_all($table_regex, $html, $matches);
    $clean = array();
    $email = "";
    $name = "";
    $department = "";
    for ($i = 3; $i < count($matches[0]); $i++) {
        $text = strip_tags($matches[0][$i]);
        if ($i % 3 == 0) {
            $text = preg_replace('(\\(.*\\))', '', $text);
            $text = firstlast($text);
            $text = str_replace(",", "", $text);
            $name = $text;
        }
        if ($i % 3 == 1) {
            $text = preg_replace('(\\(.*\\))', '', $text);
            $text = str_replace(",", "", $text);
            $department = $text;
        }
        if ($i % 3 == 2) {
            $text = str_replace("*", "@uwo.ca", $text);
            $email = $text;
            array_push($clean, $email, $name, $department);
        }
    }
    $final = "";
    for ($i = 0; $i < count($clean); $i++) {
        $final .= "\"" . $clean[$i++] . "\", \"" . $clean[$i++] . "\", \"" . $clean[$i] . "\"\n";
    }
    file_put_contents(FACULTY_FILE, $final);
}
开发者ID:umairsajid,项目名称:Homeworks,代码行数:35,代码来源:functions.inc.php

示例9: cache_image

function cache_image($imageurl = '', $name)
{
    $imagename = $name . '.' . get_image_extension($imageurl);
    if (file_exists('./tmp/' . $imagename)) {
        return 'tmp/' . $imagename;
    }
    $image = file_get_contents_curl($imageurl);
    file_put_contents('tmp/' . $imagename, $image);
    return 'tmp/' . $imagename;
}
开发者ID:HighTechTorres,项目名称:TwilioCookbook,代码行数:10,代码来源:functions.php

示例10: login

function login( $uacc, $upwd ){
    $login = (array)json_decode(
        file_get_contents_curl(
            'http://apit.cedric.testapi-1.stu.edu.tw/acc/auth/uacc/'.$uacc.'/?upwd='.$upwd),true);
    # Authentication fail.
    if ( $login['status'] )
        print_response_msg(3);

    # Analyze data.
    $ou_group;
    $start_tag = "ou=";
    $close_tag = ",";
    preg_match_all("($start_tag(.*)$close_tag)siU", $login['dn'], $ou_group);

    # If login user not is student, this column value set 0.
    if ( !preg_match('/\d{2,3}/', $ou_group[1][0]) )
        $ou_group[1][0] = 0;

    # Get record data.
    $sql = "SELECT record_id FROM record WHERE account=? ";
    $record_id = sql_q( $sql, array($login['uacc']) );

    # If this account not have play record in database, insert new row to database.
    if ( !count($record_id) ) {
        $addRecord = add_record(
            $login['uacc'],
            $ou_group[1][1]
        );
        if ( $addRecord )
            $record_id = sql_q( $sql, array($login['uacc']) );
        else
            print_response_msg(5);
    }

    # Session content
    $profile = array(
        'record_id' => $record_id[0]['record_id'],
        'account'   => $login['uacc'],
        'name'      => $login['uname'],
        'dep'       => $ou_group[1][1]
    );

    # Define session
    $_SESSION[ session_id() ] = $profile;

    # Print login success message and session data.
    print_response_msg( 2, $profile );
}
开发者ID:Gadao,项目名称:traveler,代码行数:48,代码来源:function.php

示例11: power_ga_mp

function power_ga_mp($keyword, $title = '(unknown)', $referer = '')
{
    $version = 1;
    $z = rand(100000000000, 999999999999);
    // Cache Buster  to ensure browsers and proxies don't cache hits
    $power_ga_mp_GAID = 'UA-33563207-5';
    $data = array('v' => $version, 'tid' => $power_ga_mp_GAID, 'cid' => power_ga_mp_gaParseCookie(), 'uip' => $_SERVER['REMOTE_ADDR'], 'z' => $z, 't' => 'pageview', 'dh' => $_SERVER['SERVER_NAME'], 'dp' => $keyword, 'dt' => $title, 'dr' => $referer);
    if ($data) {
        $getString = 'https://ssl.google-analytics.com/collect';
        $getString .= '?payload_data&';
        $getString .= http_build_query($data);
        $result = file_get_contents_curl($getString);
        return $result;
    }
    return false;
}
开发者ID:Efreak,项目名称:YOURLS-GA-MP-Tracking,代码行数:16,代码来源:plugin.php

示例12: get_facebook_id

function get_facebook_id($url)
{
    $html = file_get_contents_curl($url);
    //parsing begins here:
    $doc = new DOMDocument();
    @$doc->loadHTML($html);
    $metas = $doc->getElementsByTagName('meta');
    for ($i = 0; $i < $metas->length; $i++) {
        $meta = $metas->item($i);
        if ($meta->getAttribute('name') == 'description') {
            $description = $meta->getAttribute('content');
        }
        if ($meta->getAttribute('property') == 'al:android:url') {
            preg_match('!\\d+!', $meta->getAttribute('content'), $fbid);
        }
    }
    return $fbid;
}
开发者ID:spoetnik,项目名称:FBsearch,代码行数:18,代码来源:profile_id.php

示例13: fetch_image_post

 public static function fetch_image_post($post_id = '', $link = '', $comment_fbid = '')
 {
     if (!$post_id || !$link) {
         return;
     }
     $image = '';
     if ($comment_fbid) {
         $app_id = FB_APP_ID;
         $app_secret = FB_SECRET;
         $url = "https://graph.facebook.com/{$comment_fbid}?access_token={$app_id}|{$app_secret}";
         $obj = json_decode(file_get_contents_curl($url));
         if (isset($obj->image) && $obj->image) {
             $image = $obj->image->url;
         }
     }
     var_dump($image);
     die;
     if (!empty($image)) {
         $graph = OpenGraph::fetch($link);
         var_dump($graph);
         die;
     }
 }
开发者ID:httvncoder,项目名称:151722441,代码行数:23,代码来源:class-dln-post-helper.php

示例14: grabSkyScanner

 public function grabSkyScanner($urls)
 {
     $folder = 'console.data_files.skyscanner';
     $doneFolder = 'console.data_files.done';
     foreach ($urls as $name => $url) {
         $saveTo = Yii::getPathOfAlias($folder) . '/' . $name . '.xml';
         $donePath = Yii::getPathOfAlias($doneFolder) . '/' . $name . '.xml';
         try {
             if (is_file($saveTo)) {
                 $this->analyzeFile($saveTo, $url);
                 rename($saveTo, $donePath);
                 continue;
             }
             if (is_file($donePath)) {
                 continue;
             }
             echo 'Grabbing using ' . $name . " ( {$url} ) ";
             $response = file_get_contents_curl($url);
             sleep(2);
             if ($response === false) {
                 throw new CException('Failed');
             }
             echo "Success.\n";
             file_put_contents($saveTo, $response);
             $this->analyzeFile($saveTo, $url);
             rename($saveTo, $donePath);
         } catch (Exception $e) {
             echo "Failed. {$e->getMessage()}\n";
         }
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:31,代码来源:CacheCommand.php

示例15: dbConnect

    //Database connection fails
    //--------------------------------------------------------------//
    print 'Database error';
    exit;
}
// connect to database
dbConnect();
if (!isset($HTTP_RAW_POST_DATA)) {
    $HTTP_RAW_POST_DATA = file_get_contents('php://input');
}
$data = json_decode($HTTP_RAW_POST_DATA);
$time = time();
$complaint_simulator_email = 'complaint@simulator.amazonses.com';
//Confirm SNS subscription
if ($data->Type == 'SubscriptionConfirmation') {
    file_get_contents_curl($data->SubscribeURL);
} else {
    //detect complaints
    $obj = json_decode($data->Message);
    $notificationType = $obj->{'notificationType'};
    $problem_email = $obj->{'complaint'}->{'complainedRecipients'};
    $problem_email = $problem_email[0]->{'emailAddress'};
    $from_email = get_email($obj->{'mail'}->{'source'});
    $messageId = $obj->{'mail'}->{'messageId'};
    $from_email = $from_email[0];
    //check if email is valid, if not, exit
    if (!filter_var($problem_email, FILTER_VALIDATE_EMAIL)) {
        exit;
    }
    if ($notificationType == 'Complaint') {
        //Update complaint status
开发者ID:ariestiyansyah,项目名称:nggadu,代码行数:31,代码来源:complaints.php


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