0

Linux の C++ プログラムで実行する必要があるこの cUrl コマンドがあります。Qt を使用して libcUrl を含めています。この cUrl コマンドと同等の正確なメソッド呼び出しを知る必要があります。

curl -d 'grant_type=client_credentials&client_id=mdme2323&client_secret=asdaeqwedsa24124ewesiou&scope=http://api.microsofttranslator.com' https://datamarket.accesscontrol.windows.net/v2/OAuth2-13 | python -m json.tool
4

2 に答える 2

1

新しいプロセスでコマンドを実行するのはどうですか?

QString cmd("curl -d 'grant_type=client_credentials&client_id=mdme2323&client_secret=asdaeqwedsa24124ewesiou&scope=http://api.microsofttranslator.com' https://datamarket.accesscontrol.windows.net/v2/OAuth2-13 | python -m json.tool");
QProcess::execute(cmd);
于 2012-09-11T01:42:18.047 に答える
0

これが私がそれを修正した方法です:

QProcess* proc = new QProcess();
QString cmd( "/bin/sh" );
QStringList args;
args << "-c" << "curl -d 'grant_type=client_credentials&client_id=islam123&client_secret=23ewsed323we2ewesiou&scope=http://api.microsofttranslator.com' https://datamarket.accesscontrol.windows.net/v2/OAuth2-13";
proc->execute(cmd, args);
data = proc->readAll();
于 2012-09-11T02:55:18.650 に答える