FHScan 很有趣

#include <stdio.h>
#include <iostream>
#include <windows.h>
#include <string.h>
#include "HTTPCore/HTTP.h"
#include "HTTPCore/HTTPCore.h"


#pragma comment(lib, "HTTPCore.lib")
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "ssleay32MT.lib")
#pragma comment(lib, "libeay32MT.lib")

using namespace std;

void main(int argc, char *argv[])
{

    HTTPHANDLE HTTPHandle; /*Connection HANDLE */
    PREQUEST data;
    const char server[] = "www.google.com";
    const char url[] = "/";
    unsigned int ssl = 0;
    char  *PostData  = NULL;

    InitHTTPApi();

    HTTPHandle=InitHTTPConnectionHandle((char *)server, 80, ssl);
    if (HTTPHandle)
    {
        data=SendHttpRequest(HTTPHandle,(char *)server,"GET",(char *)url,(char *)PostData,NULL,NULL,NO_AUTH);
        if (data) {

	    printf("Request Headers:\n%s",data->request->Header);
	    printf("Request Data:\n%s\n", data->request->Data);

            if (data->response) {
		printf("Basic Information from server:\n");
		printf("------------------------------\n");
                printf("Remote HTTP Server:      %s\n", data->server);
                printf("Remote HTTP Status Code: %d\n", (data->status));

                printf("Response Headers:\n%s",data->request->Header);
	    	printf("Response Data:\n%s\n", data->request->Data);

            }
            FreeRequest(data);
        }
        CloseHTTPConnectionHandle(HTTPHandle);
    }
    CloseHTTPApi();
		
}

  

posted @ 2011-08-15 00:58  noevil  阅读(473)  评论(0编辑  收藏  举报