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


PHP http_class::SaveCookies方法代码示例

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


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

示例1: flush

            echo "<H2><LI>Getting the response body ...</LI</H2>\n";
            for (;;) {
                $error = $http->ReadReplyBody($body, 1000);
                if ($error != "" || strlen($body) == 0) {
                    break;
                }
            }
            flush();
        }
    }
    $http->Close();
}
if (strlen($error) == 0) {
    echo "<H2><LI>Test saving and restoring cookies...</LI</H2>\n";
    flush();
    $http->SaveCookies($site_cookies);
    if (strlen($error = $http->RestoreCookies($site_cookies, 1)) == 0) {
        $http->SaveCookies($saved_cookies);
        if (strcmp(serialize($saved_cookies), serialize($site_cookies))) {
            echo "<H2>FAILED: the saved cookies do not match the restored cookies.</H2>\n";
        } else {
            echo "<H2>OK: the saved cookies match the restored cookies.</H2>\n";
        }
    }
}
if (strlen($error)) {
    echo "<CENTER><H2>Error: ", $error, "</H2><CENTER>\n";
}
?>
</UL>
<HR>
开发者ID:3nj0y,项目名称:webvulscan,代码行数:31,代码来源:test_cookies.php

示例2: UpdateStep2

function UpdateStep2()
{
    global $clang, $scriptname, $homedir, $buildnumber, $updatebuild, $debug, $rootdir;

    // Request the list with changed files from the server

    require_once($homedir."/classes/http/http.php");
    $updatekey=getGlobalSetting('updatekey');

    echo '<div class="header ui-widget-header">'.sprintf($clang->gT('ComfortUpdate step %s'),'2').'</div><div class="updater-background"><br />';

    $http=new http_class;
    /* 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/update/$buildnumber/$updatebuild/$updatekey",$arguments);

    $updateinfo=false;
    $error=$http->Open($arguments);
    $error=$http->SendRequest($arguments);

    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);
        $http->SaveCookies($site_cookies);
    }
    else
    {
        print( $error );
    }

    if (isset($updateinfo['error']))
    {
        echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'<br />';

        if ($updateinfo['error']==1)
        {
            setGlobalSetting('updatekey','');
            echo $clang->gT('Your update key is invalid and was removed. ').'<br />';
        }
        else
        echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'<br />';
    }
    // okay, updateinfo now contains all necessary updateinformation
    // Now check if the existing files have the mentioned checksum
    $existingfiles=array();
    $modifiedfiles=array();
    $readonlyfiles=array();
    if (!isset($updateinfo['files']))
    {
        echo "<div class='messagebox ui-corner-all'>
            <div class='warningheader'>".$clang->gT('Update server busy')."</div>
            <p>".$clang->gT('The update server is currently busy. This usually happens when the update files for a new version are being prepared.')."<br /><br />
               ".$clang->gT('Please be patient and try again in about 10 minutes.')."</p></div>
            <p><button onclick=\"window.open('$scriptname?action=globalsettings', '_top')\">".sprintf($clang->gT('Back to global settings'),'4')."</button></p>";

    }
    else
    {

        foreach ($updateinfo['files'] as $afile)
        {
            if ($afile['type']=='A' && !file_exists($rootdir.$afile['file']))
            {
                $searchpath=$rootdir.$afile['file'];
                $is_writable=is_writable(dirname($searchpath));
                while (!$is_writable && strlen($searchpath)>strlen($rootdir))
                {
                    $searchpath=dirname($searchpath);
                    if (file_exists($searchpath))
                    {
                        $is_writable=is_writable($searchpath);
                        break;

                    }
                }
                if (!$is_writable)
                {
                    $readonlyfiles[]=$searchpath;
                }
            }
            elseif (file_exists($rootdir.$afile['file']) && !is_writable($rootdir.$afile['file'])) {
                $readonlyfiles[]=$rootdir.$afile['file'];
            }


            if ($afile['type']=='A' && file_exists($rootdir.$afile['file']))
            {
                //A new file, check if this already exists
                $existingfiles[]=$afile;
            }
            elseif (($afile['type']=='D' || $afile['type']=='M')  && is_file($rootdir.$afile['file']) && sha1_file($rootdir.$afile['file'])!=$afile['checksum'])  // A deleted or modified file - check if it is unmodified
            {
//.........这里部分代码省略.........
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:101,代码来源:updater.php

示例3: _readChangelog

 private function _readChangelog(http_class $http)
 {
     $szLines = '';
     $szResponse = '';
     for (;;) {
         $httperror = $http->ReadReplyBody($szLines, 10000);
         if ($httperror != "" || strlen($szLines) == 0) {
             $changelog = json_decode($szResponse, true);
             $http->SaveCookies($cookies);
             return array($httperror, $changelog, $cookies);
         }
         $szResponse .= $szLines;
     }
 }
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:14,代码来源:update.php


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