Firefox 实时 http 标头,缓存控制后的花括号:无缓存

2024-02-02

我正在设置一个 php cURL 脚本来复制我在实时标题中看到的内容。 这是一个例子。

Cache-Control: no-cache
{"username":"[email protected] /cdn-cgi/l/email-protection","password":"mypass","namespaceId":"50000003"}

他们使用 javaScript 来登录用户,我以前从未见过这种情况。 通常,如果传输了 cookie 或表单数据,则会在标头中注明。

我如何用 cURL 发送它?

如果您打开实时 http 标头并访问this URL https://merchantcenter.intuit.com/msc/portal/login,输入无效的用户名并通过您就会看到它。


我写的这个课程可以帮助你

 function HeaderProc($response,$Run="",$String=1/*[Is 1 IF Use for String Mode ]*/){
          print_r($response);
          if($String==1){
             $response=explode("\r\n",$response);  
          }
          $PartHeader=0;
          $out[$PartHeader]=array();
          while(list($key,$val)=each($response)){
              $name='';
              $value='';
              $flag=false;
              for($i=0;$i<strlen($val);$i++){
                  if($val[$i]==":"){
                      $flag=true;
                      for($j=$i+1;$j<strlen($val);$j++){
                        if($val[$i]=="\r" and $val[$i+1]=="\n"){    
                            break;
                        }
                        $value.=$val[$j];
                      }
                      break;
                  }
                  $name.=$val[$i]; 
              }
              if($flag){
                if($name=='' and $value==''){
                    $PartHeader++;  
                }else{
                  if(isset($out[$PartHeader][$name])){
                    if(is_array($out[$PartHeader][$name])){   
                        $out[$PartHeader][$name][]=$value;
                    }else{
                        $T=$out[$PartHeader][$name];
                        $out[$PartHeader][$name]=array();
                        $out[$PartHeader][$name][0]=$T;  
                        $out[$PartHeader][$name][1]=$value;  
                    }
                  }else{
                    $out[$PartHeader][$name]=$value;
                  }
                }
              }else{
                if($name==''){
                    $PartHeader++;  
                }else{
                    if(isset($out[$PartHeader][$name])){ 
                      if(is_array($out[$PartHeader][$name])){   
                        $out[$PartHeader][$name][]=$value;
                      }else{
                        $T=$out[$PartHeader][$name];
                        $out[$PartHeader][$name]=array();
                        $out[$PartHeader][$name][0]=$T;  
                        $out[$PartHeader][$name][1]=$name;  
                      }
                    }else{
                        $out[$PartHeader][$name]=$name; 
                    }
                } 
              }
              if($Run!=""){
                $Run($name,$value);  
              }
          }
          return $out;
}

 class cURL { 
    var $headers; 
    var $user_agent; 
    var $compression; 
    var $cookie_file; 
    var $proxy; 
    var $Cookie; 
    function CookieAnalysis($Cookie){//convert str cookie to array cookie 
       //echo $Cookie;
       $this->Cookie=array();
       preg_replace_callback("~(.*?)=(.*?);~si",function($m){$this->Cookie[trim($m[1])]=trim($m[2]);},' '.$Cookie.'; ');
       return $this->Cookie;
    }
    function cURL($cookies=false,$cookie='cookies.txt',$compression='gzip',$proxy='') {
         $this->headers[] = 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
         $this->headers[] = 'Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3'; 
         $this->headers[] = 'Accept-Encoding:gzip,deflate,sdch';
         $this->headers[] = 'Accept-Language:en-US,en;q=0.8';
         $this->headers[] = 'Cache-Control:max-age=0';
         $this->headers[] = 'Connection:keep-alive';
         $this->user_agent = 'User-Agent:Mozilla/5.0 (SepidarSoft [Organic Search Engine Crawler] Linux Edition) AppleWebKit/536.5 (KHTML, like Gecko) SepidarBrowser/1.0.100.52 Safari/536.5';
         $this->compression=$compression; 
         $this->proxy=$proxy; 
         $this->cookies=$cookies; 
         if ($this->cookies == TRUE) $this->cookie($cookie); 
    } 
    function cookie($cookie_file) { 
         if (file_exists($cookie_file)) { 
            $this->cookie_file=$cookie_file; 
         } else { 
            fopen($cookie_file,'w') or $this->error('The cookie file could not be opened. Make sure this directory has the correct permissions');
            $this->cookie_file=$cookie_file; 
            @fclose($this->cookie_file); 
         } 
    }
    function GET($url) { 
         $process = curl_init($url); 
         curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); 
         curl_setopt($process, CURLOPT_HEADER, 1); 
         curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); 
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
         curl_setopt($process,CURLOPT_ENCODING , $this->compression); 
         curl_setopt($process, CURLOPT_TIMEOUT, 30); 
         if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy); 
         curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); 
         curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); 
         $response = curl_exec($process);
         $header_size = curl_getinfo($process,CURLINFO_HEADER_SIZE);
         $result['Header'] = HeaderProc(substr($response, 0, $header_size),'',1);
         foreach($result['Header'] as $HeaderK=>$HeaderP){
           foreach($HeaderP['Set-Cookie'] as $key=>$val){
             $result['Header'][$HeaderK]['Set-Cookie'][$key]=$this->CookieAnalysis($val);
           }
         }
         $result['Body'] = substr( $response, $header_size );
         $result['HTTP_State'] = curl_getinfo($process,CURLINFO_HTTP_CODE);
         $result['URL'] = curl_getinfo($process,CURLINFO_EFFECTIVE_URL); 
         curl_close($process); 
         return $result; 
    }
    function POST($url,$data) { 
         $process = curl_init($url); 
         curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); 
         curl_setopt($process, CURLOPT_HEADER, 1); 
         curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); 
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
         curl_setopt($process, CURLOPT_ENCODING , $this->compression); 
         curl_setopt($process, CURLOPT_TIMEOUT, 30); 
         if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy); 
         curl_setopt($process, CURLOPT_POSTFIELDS, $data); 
         curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); 
         curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); 
         curl_setopt($process, CURLOPT_POST, 1);
         $response = curl_exec($process); 
         $header_size = curl_getinfo($process,CURLINFO_HEADER_SIZE);
         $result['Header'] = HeaderProc(substr($response, 0, $header_size),'',1);
         foreach($result['Header'] as $HeaderK=>$HeaderP){
           foreach($HeaderP['Set-Cookie'] as $key=>$val){
             $result['Header'][$HeaderK]['Set-Cookie'][$key]=$this->CookieAnalysis($val);
           }
         }
         $result['Body'] = substr( $response, $header_size );
         $result['HTTP_State'] = curl_getinfo($process,CURLINFO_HTTP_CODE);
         $result['URL'] = curl_getinfo($process,CURLINFO_EFFECTIVE_URL);
         curl_close($process); 
         return $result; 
    }
    function error($error) { 
         echo "<center><div style='width:500px;border: 3px solid #FFEEFF; padding: 3px; background-color: #FFDDFF;font-family: verdana; font-size: 10px'><b>cURL Error</b><br>$error</div></center>";
         die; 
    } 
 } 

sample:

  $cc = new cURL(); 
  print_r( $cc->POST('http://www.domain.com','use[email protected] /cdn-cgi/l/email-protection;password=mypass;namespaceId=50000003"'));

对于旧的 PHP

function HeaderProc($response,$Run="",$String=1/*[Is 1 IF Use for String Mode ]*/){
          if($String==1){
             $response=explode("\r\n",$response);  
          }
          $PartHeader=0;
          $out[$PartHeader]=array();
          while(list($key,$val)=each($response)){
              $name='';
              $value='';
              $flag=false;
              for($i=0;$i<strlen($val);$i++){
                  if($val[$i]==":"){
                      $flag=true;
                      for($j=$i+1;$j<strlen($val);$j++){
                        if($val[$i]=="\r" and $val[$i+1]=="\n"){    
                            break;
                        }
                        $value.=$val[$j];
                      }
                      break;
                  }
                  $name.=$val[$i]; 
              }
              if($flag){
                if($name=='' and $value==''){
                    $PartHeader++;  
                }else{
                  if(isset($out[$PartHeader][$name])){
                    if(is_array($out[$PartHeader][$name])){   
                        $out[$PartHeader][$name][]=$value;
                    }else{
                        $T=$out[$PartHeader][$name];
                        $out[$PartHeader][$name]=array();
                        $out[$PartHeader][$name][0]=$T;  
                        $out[$PartHeader][$name][1]=$value;  
                    }
                  }else{
                    $out[$PartHeader][$name]=$value;
                  }
                }
              }else{
                if($name==''){
                    $PartHeader++;  
                }else{
                    if(isset($out[$PartHeader][$name])){ 
                      if(is_array($out[$PartHeader][$name])){   
                        $out[$PartHeader][$name][]=$value;
                      }else{
                        $T=$out[$PartHeader][$name];
                        $out[$PartHeader][$name]=array();
                        $out[$PartHeader][$name][0]=$T;  
                        $out[$PartHeader][$name][1]=$name;  
                      }
                    }else{
                        $out[$PartHeader][$name]=$name; 
                    }
                } 
              }
              if($Run!=""){
                $Run($name,$value);  
              }
          }
          return $out;
}

class cURL { 
    var $headers; 
    var $user_agent; 
    var $compression; 
    var $cookie_file; 
    var $proxy; 
    var $Cookie; 
    function CookieAnalysis($Cookie){//convert str cookie to array cookie 
       //echo $Cookie;
       $this->Cookie=array();
       preg_match("~(.*?)=(.*?);~si",' '.$Cookie.'; ',$M);
       $this->Cookie[trim($M[1])]=trim($M[2]);
       return $this->Cookie;
    }
    function cURL($cookies=false,$cookie='cookies.txt',$compression='gzip',$proxy='') {
         $this->headers[] = 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
         $this->headers[] = 'Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3'; 
         $this->headers[] = 'Accept-Encoding:gzip,deflate,sdch';
         $this->headers[] = 'Accept-Language:en-US,en;q=0.8';
         $this->headers[] = 'Cache-Control:max-age=0';
         $this->headers[] = 'Connection:keep-alive';
         $this->user_agent = 'User-Agent:Mozilla/5.0 (SepidarSoft [Organic Search Engine Crawler] Linux Edition) AppleWebKit/536.5 (KHTML, like Gecko) SepidarBrowser/1.0.100.52 Safari/536.5';
         $this->compression=$compression; 
         $this->proxy=$proxy; 
         $this->cookies=$cookies; 
         if ($this->cookies == TRUE) $this->cookie($cookie); 
    } 
    function cookie($cookie_file) { 
         if (file_exists($cookie_file)) { 
            $this->cookie_file=$cookie_file; 
         } else { 
            fopen($cookie_file,'w') or $this->error('The cookie file could not be opened. Make sure this directory has the correct permissions');
            $this->cookie_file=$cookie_file; 
            @fclose($this->cookie_file); 
         } 
    }
    function GET($url) { 
         $process = curl_init($url); 
         curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); 
         curl_setopt($process, CURLOPT_HEADER, 1); 
         curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); 
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
         curl_setopt($process,CURLOPT_ENCODING , $this->compression); 
         curl_setopt($process, CURLOPT_TIMEOUT, 30); 
         if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy); 
         curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); 
         curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); 
         $response = curl_exec($process);
         $header_size = curl_getinfo($process,CURLINFO_HEADER_SIZE);
         $result['Header'] = HeaderProc(substr($response, 0, $header_size),'',1);
         foreach($result['Header'] as $HeaderK=>$HeaderP){
           if(!is_array($HeaderP['Set-Cookie']))continue;
           foreach($HeaderP['Set-Cookie'] as $key=>$val){
             $result['Header'][$HeaderK]['Set-Cookie'][$key]=$this->CookieAnalysis($val);
           }
         }
         $result['Body'] = substr( $response, $header_size );
         $result['HTTP_State'] = curl_getinfo($process,CURLINFO_HTTP_CODE);
         $result['URL'] = curl_getinfo($process,CURLINFO_EFFECTIVE_URL); 
         curl_close($process); 
         return $result; 
    }
    function POST($url,$data) { 
         $process = curl_init($url); 
         curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers); 
         curl_setopt($process, CURLOPT_HEADER, 1); 
         curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent); 
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
         if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
         curl_setopt($process, CURLOPT_ENCODING , $this->compression); 
         curl_setopt($process, CURLOPT_TIMEOUT, 30); 
         if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy); 
         curl_setopt($process, CURLOPT_POSTFIELDS, $data); 
         curl_setopt($process, CURLOPT_RETURNTRANSFER, 1); 
         curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1); 
         curl_setopt($process, CURLOPT_POST, 1);
         $response = curl_exec($process); 
         $header_size = curl_getinfo($process,CURLINFO_HEADER_SIZE);
         $result['Header'] = HeaderProc(substr($response, 0, $header_size),'',1);
         foreach($result['Header'] as $HeaderK=>$HeaderP){
            if(!is_array($HeaderP['Set-Cookie']))continue;
           foreach($HeaderP['Set-Cookie'] as $key=>$val){
             $result['Header'][$HeaderK]['Set-Cookie'][$key]=$this->CookieAnalysis($val);
           }
         }
         $result['Body'] = substr( $response, $header_size );
         $result['HTTP_State'] = curl_getinfo($process,CURLINFO_HTTP_CODE);
         $result['URL'] = curl_getinfo($process,CURLINFO_EFFECTIVE_URL);
         curl_close($process); 
         return $result; 
    }
    function error($error) { 
         echo "<center><div style='width:500px;border: 3px solid #FFEEFF; padding: 3px; background-color: #FFDDFF;font-family: verdana; font-size: 10px'><b>cURL Error</b><br>$error</div></center>";
         die; 
    } 
 }

sample:

  $cc = new cURL(); 
  print_r( $cc->POST('http://www.domain.com','use[email protected] /cdn-cgi/l/email-protection;password=mypass;namespaceId=50000003"'));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Firefox 实时 http 标头,缓存控制后的花括号:无缓存 的相关文章

  • div 准备好后如何调用函数?

    我的 javascript 文件中有以下内容 var divId divIDer jQuery divId ready function createGrid Adds a grid to the html html 看起来像这样 div
  • 如何使用 JavaScript 或 jQuery 清除 Google Chrome、Mozilla Firefox 和 Safari 中的剪贴板数据

    我正在开发一个网站 我想在使用 JavaScript 或 jQuery 查看我的网站时按下打印屏幕按钮时清除剪贴板数据 谁能帮我解决这个问题 我在 Internet Explorer 中成功处理了这个问题 提前致谢 由于安全原因 您无法使用
  • 如何提高 highcharts 图表创建和渲染的性能

    我本地有一个文件JSON格式化数据 我创造了一点点PHP脚本在调用时回显该文件的输出AJAX 数据文件的大小是59k 我按照 highcharts 建议禁用动画和阴影 当我加载图表时 渲染需要非常非常长的时间 我已经粘贴了下面的脚本 我有什
  • 如何在索引视图中打印关联数据

    subjects this gt Subjects gt find all contain gt Users fields gt Users username Users email gt hydrate false gt toArray
  • 在 vuejs 上将 \n 替换为新行

    我正在尝试将 n 字符替换为来自端点的数据的新行 I tried p item licensedocument legal documentText replace r n r n g br p 并没有奏效 当我将replace 写入问题末
  • 显示 div 内的用户名列表

    我是 jQuery 新手 在我的项目中 我创建了一个类User其中代码如下所示 static ConcurrentDictionary
  • 带单引号的 XPATH 查询[重复]

    这个问题在这里已经有答案了 有人知道如何解决这个问题吗 单引号让我陷入困境 nodes xml gt xpath item contains catalog Billy s Blogs title 我尝试以各种方式逃避它 但都抛出错误 no
  • 帮助在 UIWebView 中使用 Javascript 代码

    我想在 webView 中运行以下代码 以便内容可编辑 javascript document body contentEditable true document designMode on void 0 到目前为止 我已经尝试过这个 v
  • 移动设备上的剩余悬停效果

    我一整天都在努力做这个JSFiddle http jsfiddle net gsamaras q2w4jjyt 4 也适用于手机 但我所有的尝试都没有效果 在桌面上 当用户将鼠标悬停在箭头上时 它会变成红色 在移动设备上 当用户触摸 为了单
  • MySQL LAST_INSERT_ID() 和 FOUND_ROWS()

    当 PHP 脚本每秒有数百个查询时会发生什么 它会影响这些函数吗 是否保证它们会返回当前脚本中最后一个插入语句中最后插入的 id 它会返回当前脚本中最后一次选择的行数吗 如果同时从另一个脚本进行新的插入或选择 在 FOUND ROWS 的情
  • 如何访问带有美元符号的 PHP 对象属性?

    我有一个 PHP 对象 其属性中有一个美元 符号 如何访问该属性的内容 例子 echo object gt variable Ok echo object gt variable WithDollar Syntax error With 变
  • Opera Mobile 9.7 Beta 设置焦点 [重复]

    这个问题在这里已经有答案了 我们使用手持式扫描仪将物品移入和移出库存 扫描仪运行一个 ASP 页 该页提交表单以移动项目 我们最近购买了一台运行 Windows Mobile 6 1 的新扫描仪 很快就意识到 Mobile IE 完全没用
  • Meteor:即使设置了 ANDROID_HOME 也未设置

    操作系统 Ubuntu 14 04 框架 流星1 1 0 2 应用名称 Songofy 这是输出meteor install sdk android meteor install sdk android Found Android bund
  • 如何在vuetify中设置固定工具栏?

    在 vuetify 中我使用工具栏
  • 在 JAX-WS 中使用安全性的最佳实践是什么

    这是场景 我有一些需要保护的 Web 服务 JAX WS 目前 为了身份验证需求 我提供了额外的 SecurityWService 它为授权用户提供了一些需要在请求其他服务时描述的 userid 和 sessionid 使用一些java安全
  • 电子节点集成不起作用,也普遍奇怪的电子行为[重复]

    这个问题在这里已经有答案了 我是 Electron 的新手 我一直在努力让它工作 我遇到了无法解释的行为 所以这里有一个总结 我无法让 Electron 和 html 之间的通信正常工作 即使我有nodeIntegration true 网
  • CodeIgniter加入选择为

    我的数据库中有 2 个表需要加入 一张表是 artikelen 表 另一张表是 Collections 表 我目前有 this gt db gt select this gt db gt from collecties this gt db
  • IE8 - 隐藏 div 内的表单,返回键不再起作用

    我有一个登录表单 位于带有 display none 的 div 中 然后我使用 jquery 淡入表单 但 Enter Return 键不再提交表单 如果我将显示更改为阻止 则效果很好 此问题仅存在于 IE 中 有任何想法吗 这是一个不起
  • 构造函数可以返回什么值来避免返回 this ?

    确切的情况是什么 returnJavascript 中的语句可以返回除this当使用构造函数调用时new关键词 Example function Foo return something var foo new Foo 如果我没记错的话 如
  • 阻止 Chrome 扩展程序的 popup.html 自动打开

    我正在创建一个 Chrome 扩展程序 其中包含background html每分钟从 API 请求一次信息的文件 收到信息后 它会发送消息popup html弹出窗口使用 JSON 信息将新的 HTML 元素附加到弹出窗口的主体上 问题是

随机推荐