zoukankan      html  css  js  c++  java
  • 跳过度娘的防御机制

    http://www.cnblogs.com/Delphi-Farmer/archive/2011/09/20/2182629.html

    熟悉么?反正我是烦透了!不管他是个什么玩意,暂且把它叫做度娘的防御机制。它很烦?跳过它!怎么跳?看代码:

    procedure DeleteIECache(httpStr: string); // 清理IE缓存,IE.cookies
    var 
      lpEntryInfo: PInternetCacheEntryInfo;  
      hCacheDir: LongWord;  
      dwEntrySize: LongWord;  
      cachefile: string;  
    begin 
      dwEntrySize := 0;
      FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);  
      GetMem(lpEntryInfo, dwEntrySize);  
      if dwEntrySize > 0 then
        lpEntryInfo^.dwStructSize := dwEntrySize;
      hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
      if hCacheDir <> 0 then 
      begin 
        repeat 
          if (lpEntryInfo^.CacheEntryType) and (NORMAL_CACHE_ENTRY) = NORMAL_CACHE_ENTRY then
            cachefile := pchar(lpEntryInfo^.lpszSourceUrlName);
          if pos(httpStr, cachefile) > 0 then    //清除特定网站的cookies.例如baidu.com
            DeleteUrlCacheEntry(pchar(cachefile)); //执行删除操作  
          FreeMem(lpEntryInfo, dwEntrySize);
          dwEntrySize := 0;
          FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^), dwEntrySize);  
          GetMem(lpEntryInfo, dwEntrySize);  
          if dwEntrySize > 0 then 
            lpEntryInfo^.dwStructSize := dwEntrySize;  
        until not FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize);  
      end;  
      FreeMem(lpEntryInfo, dwEntrySize);  
      FindCloseUrlCache(hCacheDir);  
    end;
     
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      DeleteIECache(Edit1.Text);
    end;

      熟悉么?只要百度过"delphi 删除cookies"  都应该看到过,不错,我抄来的。仅几句代码,就可以去掉度娘的衣杉(风韵犹存呐!口水)!

    但是我要总结的是:我是个SB,对,是这样的。上面的代码在百度知道里面存了N年,我也看到过N次,但是我不相信他,反而去用那些一长串的代码,觉得长才专业,网上转那些无用代码的相当多,实际上没用!

    好了,再给我这种菜鸟说一句:先调用DeleteIECache('baidu.com');再用个从爱好的webbrowser.go() 或者 idhttp.get() 或者......(本人真菜,不知道还有什么了)

     
  • 相关阅读:
    HOWTO get multiple value from the same name checkbox elements or radiobution elements
    你家有几台电脑
    *qian翻
    nginx 域名绑定
    linode设置汇总
    how to relize 301 redirect on bottle
    Nginx禁止未在服务器绑定的域名访问
    linode设置汇总
    sogouq免费企邮
    linode设置汇总
  • 原文地址:https://www.cnblogs.com/delphi-xe5/p/6291089.html
Copyright © 2011-2022 走看看