Exemple #1
0
response_struct _get_default(const user_opt *u, const get_default_opt *gd) {
	char options[1024];
	response_struct output;

	sprintf(options, "api_key=%s&timestamp=%s&salt=%s&signature=%s&site_user=%s", 
		u->api_key, u->timestamp, u->salt, u->signature, gd->site_user);

	if (curl_process(options, "get_default", "senderid" , GET, &output) == CURLE_OK)
		printf("\nSuccess!\n");
	else
		printf("\nError!\n");
	return output;
}
Exemple #2
0
response_struct _status(const user_opt *u, const status_opt *t)
{
	char options[1024];
	response_struct output;
	sprintf(options, "api_key=%s&salt=%s&signature=%s&timestamp=%s&count=%s",
		u->api_key, u->salt, u->signature, u->timestamp, t->count);
	
	if (curl_process(options, "status", "sms", GET, &output) == CURLE_OK)
		printf("\nSuccess!\n");
	else
		printf("\nError!\n");
	return output;
}
Exemple #3
0
response_struct _delete(const user_opt *u, const delete_opt *d) {
	char options[1024];
	response_struct output;

	sprintf(options, "api_key=%s&timestamp=%s&salt=%s&signature=%s&handle_key=%s", 
		u->api_key, u->timestamp, u->salt, u->signature, d->handle_key);

	if (curl_process(options, "delete", "senderid", POST, &output) == CURLE_OK)
		printf("\nSuccess!\n");
	else
		printf("\nError!\n");
	return output;
}
Exemple #4
0
response_struct _cancel(const user_opt *u, const cancel_opt *t)
{
	char options[1024];
	response_struct output;
	sprintf(options, "api_key=%s&salt=%s&signature=%s&timestamp=%s&mid=%s&gid=%s",
		u->api_key, u->salt, u->signature, u->timestamp, t->mid, t->gid);

	if (curl_process(options, "cancel", "sms", POST, &output) == CURLE_OK)
		printf("\nSuccess!\n");
	else
		printf("\nError!\n");
	return output;
}
Exemple #5
0
response_struct _sent(const user_opt *u, const sent_opt *s)
{
	char options[1024];
	response_struct output;
	sprintf(options, "api_key=%s&salt=%s&signature=%s&timestamp=%s&count=%s&page=%s&s_rcpt=%s&s_start=%s&s_end=%s&mid=%s&gid=%s", 
		u->api_key, u->salt, u->signature, u->timestamp, s->count, s->page, s->s_rcpt, s->s_start, s->s_end, s->mid, s->gid);
	if (curl_process(options, "sent", "sms", GET, &output) == CURLE_OK)
		printf("\nSuccess!\n");
	else
		printf("\nError!\n");
	
	return output;
}
Exemple #6
0
response_struct _register(const user_opt *u, const register_opt *r)
{
	char options[1024];
	response_struct output;

	sprintf(options, "api_key=%s&timestamp=%s&salt=%s&signature=%s&phone=%s&site_user=%s", 
		u->api_key, u->timestamp, u->salt, u->signature, r->phone, r->site_user);

	if (curl_process(options, "register", "senderid", POST, &output) == CURLE_OK)
		printf("\nSuccess!\n");
	else
		printf("\nError!\n");
	return output;
}
Exemple #7
0
response_struct _send(const user_opt *u, const send_opt *s)
{
	char options[1024];
	response_struct output;
	struct curl_httppost *formpost = NULL;
	struct curl_httppost *lastptr = NULL;
	if (strcmp(s->type, "mms"))
	{
		sprintf(options, "api_key=%s&salt=%s&signature=%s&timestamp=%s&to=%s&from=%s&text=%s&type=%s&image=%s&refname=%s&country=%s&datetime=%s&mid=%s&gid=%s&subject=%s&charset=%s&srk=%s",
			u->api_key, u->salt, u->signature, u->timestamp, s->to, s->from, s->text, s->type, s->image, s->refname, s->country, s->datetime, s->mid, s->gid, s->subject, s->charset, s->srk);
		if (curl_process(options, "send", "sms", POST, &output) == CURLE_OK)
			printf("\nSuccess!\n");
		else
			printf("\nError!\n");
	}
	else
	{
		if (multi_part_curl_process(u, s, &output) == CURLE_OK)
			printf("\nSuccess!\n");
		else
			printf("\nError!\n");
	}
	return output;
}
Exemple #8
0
void* send_curl_query(void *_idx)
{
  CURL_data *resp= NULL;
  char error_log[1024]={0, };
  FILE *fp = NULL;
  char file_name[128]={0, };
  int idx= *(int*)_idx;

  snprintf(file_name, sizeof(file_name), "./save_file/save_file_%d.txt",idx);
  unlink(file_name);
  fp = fopen(file_name,"w");

  resp = (CURL_data *)malloc(sizeof(CURL_data));
  memset(resp,0,sizeof(CURL_data));

  curl_process (resp, &url_list[idx], NULL, 0 ,error_log,sizeof(error_log));
  fprintf(fp,"[%3d]==================================\n",idx);
  fprintf(fp,"%s \n",resp->body.memory);
  fclose(fp);
  clear_data_ptr(resp);
  fprintf(stderr,"Wrrite OK[%d]\n",idx);
  free(_idx);
  return NULL;
}