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