VC获得指定URL的本地COOKIE信息
// test.cpp : 定义控制台应用程序的入口点。//
#include "stdafx.h"
#include <Windows.h>
#include <WinInet.h>
#include <iostream>
using namespace std;
int _tmain(int argc, char* argv[])
{
if (argc !=2)
{
cout << "Please useing:test http://www.google.cn";
cout << endl;
}
else
{
int ilen=strlen(argv);
if (ilen<256)
{
char szURL={0};
strncpy(szURL,argv,ilen);
LPSTR lpszData = NULL;
DWORD dwSize=0;
lpszData=new char;
memset(lpszData,0,1);
retry:
if (!InternetGetCookie(szURL, "", lpszData, &dwSize))
{
if (GetLastError()== ERROR_INSUFFICIENT_BUFFER)
{
delete []lpszData;
lpszData = new char;
memset(lpszData,0,dwSize+1);
goto retry;
}
else
{
cout<<"cookie为空!";
}
}
else
{
cout<<"获取cookie成功!"<<endl;
}
cout<<"您输入网址的cookie为:"<<endl<< lpszData <<endl;
delete[]lpszData;
}
else
{
cout <<"参数超长!";
return -1;
}
}
return 0;
}
; 看不懂,.这是什么东西啊!应该是什么网站的吧~
页:
[1]