eldar85
18.04.2010, 01:48
столкнулся с такой проблемой, не могу залогиниться на сайте...
хочу чтобы прога сама логинелась на моей страничке, но по моему получается полная чушь...
вот код, что я делаю не так?
int main(int argc, char* argv[])
{
CURL* curl;
char url[] = "http://love.ngs.ru/login/";
char proxy[] = "92.50.163.114";
long port = 8085;
char error[200];
char referer[] = "http://love.ngs.ru/";
struct curl_httppost* post = NULL;
struct curl_httppost* last = NULL;
char postdata[] = "send=ok&l=8j4w4w4w@rambler.ru&p=8j4w4w4w&remember_me=1";
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_REFERER, referer);
curl_easy_setopt(curl, CURLOPT_PROXY, "117.102.91.6:8080");
//curl_easy_setopt(curl, CURLOPT_PROXYPORT, port);
//curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
// printf("\nTrying proxy [%s:%d]:\n", proxy, port);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postdata);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 54);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 7);
curl_easy_perform(curl);
// printf("Cannot perform\nError:%s\n", error);
int i;
std::cin >> i;
return 0;
}
в итоге в консоль выводиться только хедер, а html кода нету и вообще не понятно залогинелся я или нет)
хочу чтобы прога сама логинелась на моей страничке, но по моему получается полная чушь...
вот код, что я делаю не так?
int main(int argc, char* argv[])
{
CURL* curl;
char url[] = "http://love.ngs.ru/login/";
char proxy[] = "92.50.163.114";
long port = 8085;
char error[200];
char referer[] = "http://love.ngs.ru/";
struct curl_httppost* post = NULL;
struct curl_httppost* last = NULL;
char postdata[] = "send=ok&l=8j4w4w4w@rambler.ru&p=8j4w4w4w&remember_me=1";
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_REFERER, referer);
curl_easy_setopt(curl, CURLOPT_PROXY, "117.102.91.6:8080");
//curl_easy_setopt(curl, CURLOPT_PROXYPORT, port);
//curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
// printf("\nTrying proxy [%s:%d]:\n", proxy, port);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postdata);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 54);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 7);
curl_easy_perform(curl);
// printf("Cannot perform\nError:%s\n", error);
int i;
std::cin >> i;
return 0;
}
в итоге в консоль выводиться только хедер, а html кода нету и вообще не понятно залогинелся я или нет)