⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 amhttpsocket.h

📁 一个支持EMPP协议的企信通程序,很完整可以马上用,完全socket底层协议编写,不用移动提供的API
💻 H
字号:
//link with wininet.lib

#pragma once

#include <tchar.h>
#include <windows.h>
#include <wininet.h>

/*
	custom errorcodes:
	-1: bad url...
*/

class CAmHttpSocket
{
public:
	void FreeBuffer();
	int GetPageStatusCode(); //get the HTTP statuscode for the last received page
	TCHAR* GetHeaders(const TCHAR *url); //return a pointer th the headers from an url
	int CrackURL(const char* Address,char *scheme,
		char *host ,char *path,
		char *extrainfo,int &port);
	BOOL  PutFile(const char *szFileName,const char *strSource);
	CAmHttpSocket();
	~CAmHttpSocket();
	char* GetPage(const TCHAR *url, DWORD& size,bool Post = false, const char *PostData = NULL, int PostDataLength = -1); //get a page, if post is false, HTTP GET is used othervise HTTP POST is used. if PostDataLength is -1 the data must be NULL terminated...
protected:
	bool PostUrl(const TCHAR *url, const char *PostData, int PostDataLength = -1); //open a page using http post
	TCHAR* GetHeaderLine(TCHAR *s); //get a specific line from the headers
	bool OpenUrl(const TCHAR *url); //open a page using http get
	HINTERNET hIO, hIS, hCO;
	char *ReceivedData; //the internal databuffer
	TCHAR *Headers; //the internal headerbuffer
	int LastError; //internal statuscode...
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -