當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。