因为微信公众获取access_token需要用到https,开始用http请求的时候发现不行查了之后,
发现它是需要https方式访问的.因为这方面的资料感觉有点少这里就再写一下,我也是参照大神的:
只是想多一个链接让多 一点人知道而已:
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
// Simple structure to keep track of the handle, and
// of what needs to be freed later.
typedef struct
{
int socket;
SSL *sslHandle;
SSL_CTX *sslContext;
} connection;
// For this example, we'll be testing on openssl.org
#define SERVER "183.57.48.62" // api.weixin.qq.com 服务器地址
#define PORT 443
// Establish a regular tcp connection
int tcpConnect ()
{
int error, h