Curl i wysyłanie sms z bramki sms.priv.pl

0

Witam serdecznie,
Od 2 godzin staram się napisać program, który za pomocą Curl'a będzie wysyłał sms na mój telefon. Problem leży w wysłaniu. Strona zostaje pobrana odpowiednio, gdzie pola numer telefonu, treść i podpis jest uzupełniona, ale tak jakby brakło tego ostatecznego wysłania sms'a. Program wygląda mniej więcej tak:

 // ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <curl.h>
#include <string>  
#include <iostream>  
#include <windows.h>
#include <fstream>
#include <iostream>  
using namespace std;  

  

	
size_t curl_to_string(char *ptr, size_t size, size_t nmemb, void *data)   // funkcja zapisuj¹ca Ÿrud³o stroy do zmiennej
{
    std::string *str = (std::string *) data;
    char *sptr = (char *) ptr;
    int x;

    for(x = 0; x < size * nmemb; ++x)
    {
        (*str) += ptr[x];
    }

    return size * nmemb;
}

	

int main(void)
{
  CURL *curl;
  CURLcode res;
  string data;

  curl_global_init(CURL_GLOBAL_ALL);

  curl = curl_easy_init();
  if(curl) {
  

    struct curl_slist *headers=NULL; // init to NULL is important 
	

    curl_slist_append(headers, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");  
    curl_slist_append( headers, "Accept-Language: pl,en-us;q=0.7,en;q=0.3");
    curl_slist_append( headers, "Accept-Encoding: gzip, deflate"); 
	curl_slist_append( headers, "Content-Length: 167"); 
	curl_slist_append( headers, "Content-Type: application/x-www-form-urlencoded"); 
	curl_slist_append(headers, "Connection: keep-alive");  

	curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, "http://sms.priv.pl/index.php");
curl_easy_setopt(curl, CURLOPT_REFERER,"http://sms.priv.pl");
							curl_easy_setopt(curl, CURLOPT_USERAGENT, "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0");
							curl_easy_setopt(curl, CURLOPT_HEADER, true);
							curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
							curl_easy_setopt(curl, CURLOPT_HTTPGET,1); 
							curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION, true); 
							curl_easy_setopt(curl,CURLOPT_COOKIEFILE, "cookie2.txt");
							curl_easy_setopt(curl,CURLOPT_COOKIEJAR, "cookie2.txt");
							curl_easy_setopt(curl, CURLOPT_POST,1);
							curl_easy_setopt(curl, CURLOPT_POSTFIELDS,"status=send&siec=698&nr=&number2=******&tresc=Wejd%BC+na+nasz+Video+Chat+i+poznaj+nowych+ciekawych+ludzi+-%3E+Kliknij+koniecznie+w+link+po+prawej+stronie%21%21%21&od=g");
								curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_to_string);
							curl_easy_setopt(curl, CURLOPT_WRITEDATA, &data);
							res = curl_easy_perform(curl);

							ofstream outfile2("sms.html", ios::out | ios::binary);
							outfile2<<data;
							outfile2.close();	

	if(res != CURLE_OK){
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));

	}

    curl_easy_cleanup(curl);
  }
  curl_global_cleanup();
    int z;
  cin >>z;
  return 0;

}

Czy ma ktoś jakieś rady? :) Proszę o wszelką pomoc

0

a masz sposób jakiś na captcha ? sms.priv.pl od jakiegos czasu wymaga potwierdzenia wyslania SMS'a poprzez wpisanie kodu z obrazka

0

Zależy mi jak na razie do T-Mobile, a jak wysyłałem sms-y normalnie ze strony to bez problemu, nawet nie prosiło mnie o przepisywanie kodu Captcha. Kod captcha trzeba przepisywać jeżeli się wysyła do sieci Plus tak mi się wydaje

1 użytkowników online, w tym zalogowanych: 0, gości: 1