mam problem z biblioteką libCurl, a mianowicie chce, żeby zamiast wpisanych na stałe danych zmiennych dać te ze zmiennych wpisanych przez użytkownika.
Oto kod:
Kod
#include <stdio.h>
#include <curl/curl.h>
#include <conio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(){
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://znajomek.unixstorm.org/logowanie.php");
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "login="lol&haslo=lol2");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
cout << endl;
}
system("pause");
}
#include <curl/curl.h>
#include <conio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(){
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://znajomek.unixstorm.org/logowanie.php");
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "login="lol&haslo=lol2");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
cout << endl;
}
system("pause");
}
a chcę
Kod
#include <stdio.h>
#include <curl/curl.h>
#include <conio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(){
string login,haslo, dane;
cout << "Wpisz login: ";
cin >> login;
cout <<endl << "Haslo: ";
cin >> haslo;
cout << endl;
dane = "login=",login,"&haslo=",haslo;
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://znajomek.unixstorm.org/logowanie.php");
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, dane);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
cout << endl;
}
system("pause");
}
#include <curl/curl.h>
#include <conio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(){
string login,haslo, dane;
cout << "Wpisz login: ";
cin >> login;
cout <<endl << "Haslo: ";
cin >> haslo;
cout << endl;
dane = "login=",login,"&haslo=",haslo;
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://znajomek.unixstorm.org/logowanie.php");
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, dane);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
cout << endl;
}
system("pause");
}
I po włączeniu app'a wywala mi błąd ....
pomocy ;(