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


PHP http::ReadReplyBody方法代码示例

本文整理汇总了PHP中http::ReadReplyBody方法的典型用法代码示例。如果您正苦于以下问题:PHP http::ReadReplyBody方法的具体用法?PHP http::ReadReplyBody怎么用?PHP http::ReadReplyBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在http的用法示例。


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

示例1: getUpdateInfo

function getUpdateInfo()
{
    //require_once($homedir."/classes/http/http.php");
    Yii::import('application.libraries.admin.http.http');
    $http = new http();
    $http->timeout = 0;
    $http->data_timeout = 0;
    $http->user_agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
    $http->GetRequestArguments("http://update.limesurvey.org?build=" . Yii::app()->getConfig("buildnumber"), $arguments);
    $updateinfo = false;
    $error = $http->Open($arguments);
    $error = $http->SendRequest($arguments);
    $http->ReadReplyHeaders($headers);
    if ($error == "") {
        $body = '';
        $full_body = '';
        for (;;) {
            $error = $http->ReadReplyBody($body, 10000);
            if ($error != "" || strlen($body) == 0) {
                break;
            }
            $full_body .= $body;
        }
        $updateinfo = json_decode($full_body, true);
        if ($http->response_status != '200') {
            $updateinfo['errorcode'] = $http->response_status;
            $updateinfo['errorhtml'] = $full_body;
        }
    } else {
        $updateinfo['errorcode'] = $error;
        $updateinfo['errorhtml'] = $error;
    }
    unset($http);
    return $updateinfo;
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:35,代码来源:common_helper.php

示例2: _RunUpdaterUpdate

 private function _RunUpdaterUpdate()
 {
     $clang = $this->getController()->lang;
     $versionnumber = Yii::app()->getConfig("versionnumber");
     $buildnumber = Yii::app()->getConfig("buildnumber");
     $tempdir = Yii::app()->getConfig("tempdir");
     $http = new http();
     /* Connection timeout */
     $http->timeout = 0;
     /* Data transfer timeout */
     $http->data_timeout = 0;
     $http->user_agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
     $http->GetRequestArguments("http://update.limesurvey.org?updaterbuild={$buildnumber}", $arguments);
     $updateinfo = false;
     $error = $http->Open($arguments);
     $error = $http->SendRequest($arguments);
     $http->ReadReplyHeaders($headers);
     if ($error == "") {
         $body = '';
         $full_body = '';
         for (;;) {
             $error = $http->ReadReplyBody($body, 10000);
             if ($error != "" || strlen($body) == 0) {
                 break;
             }
             $full_body .= $body;
         }
         $updateinfo = json_decode($full_body, true);
         if ($http->response_status != '200') {
             $updateinfo['errorcode'] = $http->response_status;
             $updateinfo['errorhtml'] = $full_body;
         }
     } else {
         $updateinfo['errorcode'] = $error;
         $updateinfo['errorhtml'] = $error;
     }
     unset($http);
     if ((int) $updateinfo['UpdaterRevision'] <= $buildnumber) {
         // There is no newer updater version on the server
         return true;
     }
     if (!is_writable($tempdir) || !is_writable(APPPATH . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'update.php')) {
         $error = true;
     }
     //  Download the zip file, unpack it and replace the updater file accordingly
     // Create DB and file backups now
     $downloaderror = false;
     $http = new http();
     // Allow redirects
     $http->follow_redirect = 1;
     /* Connection timeout */
     $http->timeout = 0;
     /* Data transfer timeout */
     $http->data_timeout = 0;
     $http->user_agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
     $http->GetRequestArguments("http://update.limesurvey.org/updates/downloadupdater/{$this->updaterversion}", $arguments);
     $httperror = $http->Open($arguments);
     $httperror = $http->SendRequest($arguments);
     $http->ReadReplyHeaders($headers);
     if ($headers['content-type'] == 'text/html') {
         @unlink($tempdir . '/updater.zip');
     } elseif ($httperror == '') {
         $body = '';
         $full_body = '';
         for (;;) {
             $httperror = $http->ReadReplyBody($body, 100000);
             if ($httperror != "" || strlen($body) == 0) {
                 break;
             }
             $full_body .= $body;
         }
         file_put_contents($tempdir . '/updater.zip', $full_body);
     }
     $aData['httperror'] = $httperror;
     //Now unzip the new updater over the existing ones.
     if (file_exists($tempdir . '/updater.zip')) {
         Yii::app()->loadLibrary("admin/pclzip/pclzip", array('p_zipname' => $tempdir . '/updater.zip'));
         $archive = new PclZip(array('p_zipname' => $tempdir . '/updater.zip'));
         if ($archive->extract(PCLZIP_OPT_PATH, APPPATH . '/controllers/admin/', PCLZIP_OPT_REPLACE_NEWER) == 0) {
             die("Error : " . $archive->errorInfo(true));
         } else {
             unlink($tempdir . '/updater.zip');
         }
         $updater_exists = true;
     } else {
         $updater_exists = false;
         $error = true;
     }
     $aData['updater_exists'] = $updater_exists;
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:90,代码来源:update.php


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