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


PHP curl_get函数代码示例

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


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

示例1: get_product

function get_product($url, $page = 0)
{
    global $save_folder;
    $html = curl_get($url);
    //Загружает страницу товара
    $dom = str_get_html($html);
    $article = $dom->find('article', 0);
    //Берем артикул
    $str = $article->attr['id'];
    sscanf($str, 'post-%d', $art);
    $scripts = $dom->find('script');
    foreach ($scripts as $script) {
        if (strpos($script->src, "script.js")) {
            $str = "script[src='" . $script->src . "']";
        }
    }
    $dom->find($str, 0)->outertext = '';
    //Ajax запрос
    $html = get_ajax($art);
    //Получили данные из ajax
    $dom2 = str_get_html($html);
    //Ищем в 1-й странице div куда будем вставлять данные из ajax
    $dom->find('div[id=order-variables]', 0)->innertext = $dom2;
    //Сохраняем HTML
    file_put_contents($save_folder . 'product--' . $page . '.html', $dom);
}
开发者ID:Lyoshka,项目名称:evseeva.loc,代码行数:26,代码来源:index.php

示例2: normal_sign

function normal_sign($uid, $tieba)
{
    $setting = get_setting($uid);
    $url = "http://tieba.baidu.com/mo/m?kw={$tieba[unicode_name]}";
    $get_url = curl_get($url, $uid);
    if (!$get_url) {
        return array(1, '无法打开贴吧首页', 0);
    }
    $get_url = wrap_text($get_url);
    preg_match('/<ahref="([^"]*?)">签到<\\/a>/', $get_url, $matches);
    if (isset($matches[1])) {
        $s = str_replace('&amp;', '&', $matches[1]);
        $sign_url = 'http://tieba.baidu.com' . $s;
        $get_sign = curl_get($sign_url, $uid, $setting['use_bdbowser']);
        $done++;
        if (!$get_sign) {
            return array(1, '签到错误,可能已经签到成功,稍后重试', 0);
        }
        $get_sign = wrap_text($get_sign);
        preg_match('/<spanclass="light">签到成功,经验值上升<spanclass="light">(\\d+)<\\/span>/', $get_sign, $matches);
        if ($matches[1]) {
            return array(2, "签到成功,经验值+{$matches[1]}", $matches[1]);
        } else {
            return array(1, '签到错误,可能已经签到成功,稍后重试', 0);
        }
    } else {
        preg_match('/<span>已签到<\\/span>/', $get_url, $matches);
        if ($matches[0]) {
            return array(2, '此前已成功签到', 0);
        } else {
            return array(-1, '找不到签到链接,稍后重试', 0);
        }
    }
}
开发者ID:ahmatjan,项目名称:Tieba_Sign,代码行数:34,代码来源:sign.php

示例3: getKuaiDi

function getKuaiDi($ID, $name)
{
    global $kuaidi;
    include_once HANDLE_DIR . 'libs/pinYin.class.php';
    include_once dirname(dirname(dirname(__FILE__))) . '/tools.class.php';
    $name = pinYin::convert($name, 'utf8');
    /*-------------- 获取内容 -------------*/
    $url = $kuaidi['url'] . '?key=' . $kuaidi['key'] . '&order=' . $ID . '&id=' . $name . '&show=xml';
    $response = curl_get($url);
    /*---------------- 结束获取----------------*/
    $kuaidiobj = simplexml_load_string($response);
    //xml解析
    $kuaidistatus = $kuaidiobj->Status;
    //获取快递状态
    $kuaistr = strval($kuaidistatus);
    //对象转换为字符串
    $contentStr0 = $kuaidi['statusCode'][$kuaistr];
    //根据数组返回
    foreach ($kuaidiobj->Data->Order as $a) {
        foreach ($a->Time as $b) {
            foreach ($a->Content as $c) {
                $m .= "{$b}\n{$c}。\n";
            }
        }
    }
    //遍历获取快递时间和事件
    $contentStr = "你的快递单号{$ID}{$contentStr0}\n{$m}";
    return $contentStr;
}
开发者ID:Nightchen0521,项目名称:cmf,代码行数:29,代码来源:index.php

示例4: sendsiderr

function sendsiderr($qq, $sid, $err = 'sid')
{
    global $backurl;
    curl_get($backurl . 'api.php?my=siderr&qq=' . $qq . '&sid=' . $sid . '&err=' . $err);
    if (isset($_POST['backurl'])) {
        curl_get($backurl . 'api.php?my=sendmail&qq=' . $qq . '&sid=' . $sid . '&err=' . $err);
    }
}
开发者ID:sembrono,项目名称:1,代码行数:8,代码来源:qq.inc.php

示例5: get_mv_info

function get_mv_info($mv_id)
{
    $url = "http://music.163.com/api/mv/detail?id={$mv_id}&type=mp4";
    $output = curl_get($url);
    $mvs = $output['data']['brs'];
    $mv = "1080P:" . $mvs['1080'] . "<br>720P:" . $mvs['720'] . "<br>480P:" . $mvs['480'] . "<br>240P:" . $mvs['240'];
    print_r($mv);
}
开发者ID:vino24,项目名称:WechatMusicSearch,代码行数:8,代码来源:neteaseApi.php

示例6: get_sport

function get_sport($athlete)
{
    $sports = array("football", "cricket", "badminton", "tennis", "golf");
    $max_count = array(0, 0, 0, 0, 0);
    function curl_get($url)
    {
        $return = '';
        function_exists('curl_init') ? '' : die('cURL Must be installed!');
        $curl = curl_init();
        $header[0] = "Accept: text/xml,application/xml,application/json,application/xhtml+xml,";
        $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
        $header[] = "Cache-Control: max-age=0";
        $header[] = "Connection: keep-alive";
        $header[] = "Keep-Alive: 300";
        $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
        $header[] = "Accept-Language: en-us,en;q=0.5";
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 30);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        $result = curl_exec($curl);
        curl_close($curl);
        return $result;
    }
    foreach ($athlete as $var) {
        $url = "http://en.wikipedia.org/wiki/" . preg_replace("/ /", '_', $var['name']);
        $long_url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22" . rawurlencode($url) . "%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2Fdiv%5B%40id%3D%22mw-content-text%22%5D%2Fp%5B1%5D'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=";
        $result = curl_get($long_url);
        $result = preg_split('/([\\s\\-_,:;?!\\/\\(\\)\\[\\]{}<>\\r\\n"]|(?<!\\d)\\.(?!\\d))/', $result, null, PREG_SPLIT_NO_EMPTY);
        $count = array(0, 0, 0, 0, 0);
        foreach ($result as $str) {
            for ($i = 0; $i < 5; $i++) {
                if ($sports[$i] == $str) {
                    $count[$i]++;
                }
            }
        }
        $pos = 0;
        for ($i = 0; $i < 5; $i++) {
            if ($count[$i] > $count[$pos]) {
                $pos = $i;
            }
        }
        if ($count[$pos]) {
            $max_count[$pos]++;
        }
    }
    $pos = 0;
    for ($i = 0; $i < 5; $i++) {
        if ($max_count[$i] > $max_count[$pos]) {
            $pos = $i;
        }
    }
    return $sports[$pos];
}
开发者ID:rohit-gupta,项目名称:Smalltalk,代码行数:58,代码来源:getsports.php

示例7: getDataFromNotification

 public function getDataFromNotification($notification_id)
 {
     if ($this->sandboxmode) {
         $url = "ws.sandbox.pagseguro.uol.com.br";
     } else {
         $url = "ws.pagseguro.uol.com.br";
     }
     return json_decode(json_encode(simplexml_load_string(curl_get('https://' . $url . '/v2/transactions/notifications/' . $notification_id, array('email' => $this->email, 'token' => $this->token)))), true);
 }
开发者ID:Turox,项目名称:Pagseguro-IPN,代码行数:9,代码来源:ipnlistener.php

示例8: curl_get_json

function curl_get_json($url, $proxy_server = '', $proxy_port = '', array $get = NULL, array $options = array())
{
    $options[CURLOPT_HTTPHEADER] = array('Content-Type: application/json');
    $result = curl_get($url, $proxy_server, $proxy_port, $get, $options);
    if ($result['data'] != false && $result['info']['http_code'] == 200) {
        $result['json'] = json_decode($result['data']);
    }
    return $result;
}
开发者ID:johnedelatorre,项目名称:fusion,代码行数:9,代码来源:pugpig_amazon.php

示例9: gist_detail_raw

function gist_detail_raw()
{
    // Lấy chi tiết của 1 gist
    //$value = "https://gist.githubusercontent.com/vihoangson/89ab60fe9bfa1d34892b/raw/384cfe35243fe625e1b71595ca5ad31c59e662a8/B%C3%AD%20k%C3%ADp%20v%C3%B5%20c%C3%B4ng%201000%20b%C3%A0i%20k%E1%BB%B9%20thu%E1%BA%ADt%20l%E1%BA%ADp%20tr%C3%ACnh%20c%E1%BB%A7a%20Nguy%E1%BB%85n%20T%E1%BA%A5n%20Tr%E1%BA%A7n%20Minh%20Khang.md";
    $result = curl_get($value);
    echo "<pre>";
    echo htmlentities($result);
    echo "</pre>";
}
开发者ID:vihoangson,项目名称:tool_of_santo,代码行数:9,代码来源:api_gist.php

示例10: request

 function request($operation, $data)
 {
     $url = "{$this->requestURL}&Operation={$operation}&AWSAccessKeyId={$this->pubKey}&AssociateTag={$this->assocTag}" . $this->buildData($data);
     $url = $this->getRequest($url);
     //echo "<a href='$url'>XML</a>";
     $response = curl_get($url);
     $xml = simplexml_load_string($response);
     return $xml;
 }
开发者ID:therealchiko,项目名称:getchabooks,代码行数:9,代码来源:AmazonAPI.php

示例11: flickr_api_call

function flickr_api_call($method, $params)
{
    $api_url = FLICKR_URL_BASE;
    $api_url .= '&api_key=' . FLICKR_API_KEY_PUBLIC;
    foreach ($params as $key => $value) {
        $api_url .= '&' . $key . '=' . urlencode($value);
    }
    $result_string = curl_get($api_url);
    $result_xml = simplexml_load_string($result_string);
    return $result_xml;
}
开发者ID:nateforsyth,项目名称:openheatmap,代码行数:11,代码来源:flickrfetch.php

示例12: frontPageFeaturedVideos

function frontPageFeaturedVideos($baseUrl)
{
    //?source=YouTube&sorts=most_viewed&period=week
    $source = 'YouTube,Metacafe,Dailymotion';
    $sorts = 'most_viewed';
    $period = 'week';
    $urlToCall = $baseUrl . '/api/getVideos?source=' . $source . '&sorts=' . $sorts . '&period=' . $period;
    $videos = curl_get($urlToCall);
    var_dump($videos);
    die;
}
开发者ID:videouri,项目名称:videouri-old,代码行数:11,代码来源:videouriCron.php

示例13: jokei_txt

function jokei_txt()
{
    $str = curl_get('http://jokei.aliapp.com/m/api.php?key=hu60&act=txt');
    $str = json_decode($str, true);
    if (!$str) {
        return randstr();
    }
    $txt = str_replace('[br]', "\r\n", $str['txt']);
    $title = $str['title'];
    $str = '《' . $title . '》' . $txt;
    return $str;
}
开发者ID:sembrono,项目名称:1,代码行数:12,代码来源:shuo.func.php

示例14: apiGo

function apiGo($userName, $cellphone, $openId)
{
    $soureName = 'e2693f6ad8c67d831e5d64785613bb71';
    $url = "https://prcws.acxiom.com.cn/PRC/rest/customer/general?obj={'source_name':'" . $soureName . "','username':'" . urlencode($userName) . "','cellphone':'" . $cellphone . "','openId':'" . $openId . "'}";
    $res = curl_get($url);
    $arr = json_decode($res, true);
    if ($arr && is_array($arr)) {
        if ($arr["WS_RESPONSE"]["RETURN_CODE"]) {
            return $arr["WS_RESPONSE"]["RETURN_CODE"];
        }
    }
    return false;
}
开发者ID:lyt308012546,项目名称:vice,代码行数:13,代码来源:handle.php

示例15: bankInfo

 public function bankInfo($card)
 {
     if (!$card) {
         $card = I('get.card');
     }
     $curlUrl = "https://www.zhimale.com/Api/bank/card/" . $card;
     $res = curl_get($curlUrl);
     if ($res) {
         $this->ajaxReturn(array('status' => 1, 'info' => $res));
     } else {
         $this->ajaxReturn(array('status' => 1, 'info' => ''));
     }
 }
开发者ID:ysc8620,项目名称:zhima,代码行数:13,代码来源:BankController.class.php


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