Пытаюсь отправить запрос post но не получается, Get приходит а post нет.
С++
#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/StreamCopier.h>
#include <Poco/Path.h>
#include <Poco/URI.h>
#include <Poco/Exception.h>
#include <iostream>
#include <string>
using namespace Poco::Net;
using namespace Poco;
using namespace std;
std::string Post(std::string url)
{
try
{
// prepare session
URI uri(url.c_str());
HTTPClientSession session(uri.getHost(), uri.getPort());
//Подготовить путь
string path(uri.getPathAndQuery());
//
if (path.empty()) path = "/";
// send request
HTTPRequest req(HTTPRequest::HTTP_POST, path, HTTPMessage::HTTP_1_1);
session.sendRequest(req);
// get response
HTTPResponse res;
//if(res.getStatus() == 200)
std::string resR = "";
// print response
istream &is = session.receiveResponse(res);
// StreamCopier::copyStream(is, cout);
char A[255];
is.getline(A,255);
resR += A;
return resR;
}
catch (Exception &ex)
{
//cerr << ex.displayText() << endl;
return "";
}//
return "";
}
int main(int argc, char **argv)
{
std::string url = "http://autorization.com/tttt/g.php?Dat=test";
Post(url);
return 0;
}
php
<?php
file_put_contents('t/1.txt',$_POST['Dat']);
file_put_contents('t/2.txt',$_GET['Dat']);
?>
ps Отправляемые данные числовой массив объёмом 10mb в виде текста.