久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <legend id='0sZL4'><style id='0sZL4'><dir id='0sZL4'><q id='0sZL4'></q></dir></style></legend>
    • <bdo id='0sZL4'></bdo><ul id='0sZL4'></ul>
    <tfoot id='0sZL4'></tfoot>

    <small id='0sZL4'></small><noframes id='0sZL4'>

    1. <i id='0sZL4'><tr id='0sZL4'><dt id='0sZL4'><q id='0sZL4'><span id='0sZL4'><b id='0sZL4'><form id='0sZL4'><ins id='0sZL4'></ins><ul id='0sZL4'></ul><sub id='0sZL4'></sub></form><legend id='0sZL4'></legend><bdo id='0sZL4'><pre id='0sZL4'><center id='0sZL4'></center></pre></bdo></b><th id='0sZL4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0sZL4'><tfoot id='0sZL4'></tfoot><dl id='0sZL4'><fieldset id='0sZL4'></fieldset></dl></div>

      如何加速php中的cURL?

      How to speed up cURL in php?(如何加速php中的cURL?)

        <i id='BNo4t'><tr id='BNo4t'><dt id='BNo4t'><q id='BNo4t'><span id='BNo4t'><b id='BNo4t'><form id='BNo4t'><ins id='BNo4t'></ins><ul id='BNo4t'></ul><sub id='BNo4t'></sub></form><legend id='BNo4t'></legend><bdo id='BNo4t'><pre id='BNo4t'><center id='BNo4t'></center></pre></bdo></b><th id='BNo4t'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BNo4t'><tfoot id='BNo4t'></tfoot><dl id='BNo4t'><fieldset id='BNo4t'></fieldset></dl></div>
        <tfoot id='BNo4t'></tfoot>

        <legend id='BNo4t'><style id='BNo4t'><dir id='BNo4t'><q id='BNo4t'></q></dir></style></legend>
                <tbody id='BNo4t'></tbody>

              <small id='BNo4t'></small><noframes id='BNo4t'>

                <bdo id='BNo4t'></bdo><ul id='BNo4t'></ul>

                本文介紹了如何加速php中的cURL?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我正在嘗試從 Twitter 嵌入推文.所以,我使用 cURL 來取回 json.我寫了一個(gè)小測(cè)試,但測(cè)試大約需要 5 秒,當(dāng)我在本地運(yùn)行時(shí).所以,我不確定我在這里做錯(cuò)了什么.

                I'm trying to get embed tweet from Twitter. So, I'm using cURL to get the json back. I wrote a little test but the test takes around 5 seconds as well as when I run locally. So, I'm not sure what am I doing wrong here.

                public function get_tweet_embed($tw_id) {
                
                    $json_url = "https://api.twitter.com/1/statuses/oembed.json?id={$tw_id}&align=left&omit_script=true&hide_media=false";
                
                    $ch = curl_init( $json_url );
                    $start_time = microtime(TRUE);
                    $JSON = curl_exec($ch);
                    $end_time = microtime(TRUE);
                    echo $end_time - $start_time; //5.7961111068726
                
                    return $this->get_html($JSON);
                }
                
                private function get_html($embed_json) {
                    $JSON_Data = json_decode($embed_json,true);
                    $tw_embed_code = $JSON_Data["html"];
                    return $tw_embed_code;
                }
                

                當(dāng)我粘貼鏈接并從瀏覽器進(jìn)行測(cè)試時(shí),速度非常快.

                When I paste the link and test it from the browser it's really fast.

                推薦答案

                關(guān)于環(huán)境,我在 PHP 中觀察到,cURL 通常在大多數(shù)環(huán)境中運(yùn)行得非常快,除了在 CPU 低且網(wǎng)絡(luò)較慢的地方表現(xiàn).例如,在我的 MAMP 安裝的 localhost 上,curl 很快,在較大的亞馬遜實(shí)例上,curl 很快.但是在一個(gè)糟糕的小型主機(jī)上,我看到它存在性能問題,連接速度明顯變慢.不過,我不確定為什么會(huì)變慢.此外,它肯定不會(huì)慢 5 秒.

                With respect to environment, I've observed in PHP that cURL typically runs very fast in most environments except in places where there is low CPU and there is slower network performance. For example, on localhost on my MAMP installation, curl is fast, on a larger amazon instance, curl is fast. But on a small crappy hosting, i've seen it have performance issues where it is noticeably slower to connect. Though, i'm not sure exactly why that is slower. Also, it sure wasn't 5 seconds slower.

                為了幫助確定是 PHP 還是您的環(huán)境,您應(yīng)該嘗試通過命令行與 curl 交互.至少,如果還有 5 秒,您就可以排除 PHP 代碼的問題.

                to help determine if its PHP or your environment, you should try interacting with curl via the command line. At least that you'll be able to rule out PHP code being the problem if its still 5 seconds.

                這篇關(guān)于如何加速php中的cURL?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動(dòng)游標(biāo)不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個(gè)值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動(dòng)程序)

                <i id='CPHMt'><tr id='CPHMt'><dt id='CPHMt'><q id='CPHMt'><span id='CPHMt'><b id='CPHMt'><form id='CPHMt'><ins id='CPHMt'></ins><ul id='CPHMt'></ul><sub id='CPHMt'></sub></form><legend id='CPHMt'></legend><bdo id='CPHMt'><pre id='CPHMt'><center id='CPHMt'></center></pre></bdo></b><th id='CPHMt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CPHMt'><tfoot id='CPHMt'></tfoot><dl id='CPHMt'><fieldset id='CPHMt'></fieldset></dl></div>
                  <bdo id='CPHMt'></bdo><ul id='CPHMt'></ul>
                  <tfoot id='CPHMt'></tfoot>

                    <legend id='CPHMt'><style id='CPHMt'><dir id='CPHMt'><q id='CPHMt'></q></dir></style></legend>

                            <tbody id='CPHMt'></tbody>
                        • <small id='CPHMt'></small><noframes id='CPHMt'>

                          主站蜘蛛池模板: 国产一区二区三区在线 | 国产高清精品在线 | 久久久影院 | 午夜小电影 | 毛片一区二区三区 | 91在线视频免费观看 | 91在线看| 精品国产乱码久久久久久中文 | 免费看a| 亚洲视频免费观看 | 神马久久久久久久久久 | 亚洲综合大片69999 | 黄色av网站免费看 | 国产在线中文字幕 | 欧美日韩综合视频 | 中文字字幕一区二区三区四区五区 | 日本免费一区二区三区四区 | 人人做人人澡人人爽欧美 | 国产精品v| 久久激情视频 | 亚洲美女网站 | 麻豆精品久久 | 欧美在线二区 | 日日骚av | 日韩精品视频在线 | 天堂色网 | 亚洲视频在线免费观看 | 韩国理论电影在线 | 丝袜 亚洲 另类 欧美 综合 | 国产一区二区三区色淫影院 | av在线亚洲天堂 | 中文字幕在线播放第一页 | 黄色一级毛片免费看 | 久久久国产一区二区三区 | 精品国产欧美一区二区 | 91免费电影 | 一区二区三区视频免费观看 | 999精品在线观看 | 日韩在线中文 | 欧美在线一区二区三区 | 国产色婷婷精品综合在线播放 |