#include <SendForm.h>
Public Member Functions | |
SendForm (const QUrl &destination) | |
void | addField (const QString &name, const QString &value) |
void | addFields (const QStringList &names, const QStringList &values) |
void | clearFields () |
void | addFile (const QString &name, const QString &file) |
void | addFiles (const QStringList &names, const QStringList &files) |
void | clearFiles () |
void | clear () |
void | setHeader (const QByteArray &headerName, const QByteArray &headerValue) |
void | setReferer (const QString &url) |
void | setDefaultUserAgent () |
void | forceMultipart () |
void | removeMultipart () |
QNetworkReply * | post (QNetworkAccessManager *manager) |
SendForm can send files and fields (html's <input>) to a website.
SendForm::SendForm | ( | const QUrl & | destination | ) |
Constructor
destination | : url that will received the form |
Constructor
void SendForm::addField | ( | const QString & | name, | |
const QString & | value | |||
) |
add a field to the form
name | : the name of the field | |
value | : the value of the field |
add a field to the form
void SendForm::addFields | ( | const QStringList & | names, | |
const QStringList & | values | |||
) |
add several fields at once
names | : the names of the field | |
values | : the values of the field |
add several fields at once
void SendForm::addFile | ( | const QString & | name, | |
const QString & | file | |||
) |
add a field "file" to the form
name | : the name of the field | |
file | : the file path |
add a field "file" to the form
void SendForm::addFiles | ( | const QStringList & | names, | |
const QStringList & | files | |||
) |
add several files at once
names | : the names of the field | |
files | : the files path |
add several files at once
void SendForm::clear | ( | ) |
remove all the fields and all the files of the form
remove all the fields and all the files of the form
void SendForm::clearFields | ( | ) |
remove all fields (except the "file" ones) of the form
remove all fields (except the "file" ones) of the form
void SendForm::clearFiles | ( | ) |
remove all the files of the form
void SendForm::forceMultipart | ( | ) |
force the form to be send as "multipart/form-data" instead of "x-www-form-urlencoded"
force the form to be send as "multipart/form-data" instead of "x-www-form-urlencoded"
QNetworkReply * SendForm::post | ( | QNetworkAccessManager * | manager | ) |
send the form
manager | : a valid QNetworkAccessManager that will be used to |
send the form
void SendForm::removeMultipart | ( | ) |
force the form to be send as "x-www-form-urlencoded" instead of "multipart/form-data" if you called "forceMultipart" before
force the form to be send as "x-www-form-urlencoded" instead of "multipart/form-data" if you called "forceMultipart" before
void SendForm::setDefaultUserAgent | ( | ) |
set the user-agent to "Mozilla/5.0"
void SendForm::setHeader | ( | const QByteArray & | headerName, | |
const QByteArray & | headerValue | |||
) |
set a header
headerName | : the name of the header (i.e. "Content-type", "Accept", ...) | |
headerValue | : the value of the field |
set a header
void SendForm::setReferer | ( | const QString & | url | ) |
set the referer's url
url | : the url you come from |
set the referer's url