void GalleryCreator create QStringList urls QString text QString user

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
void GalleryCreator::create(QStringList urls, QString text, QString user, QString pass, QString shortlink)
{
QStringList images;
foreach(QString url, urls)
{
QString image = url.split("hostname.us/").at(1);
images.append(image);
}
QStringList postlist;
for(int i=0; i<images.size(); i++)
{
postlist.append("imgfile"+QString::number(i+1)+"=" + images.at(i));
}
QString post = postlist.join("&");
QString first = images.at(0);
QStringList parts = first.split("/");
QString path = QString(GALLERY_PATH);
QHttpRequestHeader header("POST", path, 1, 1);
header.addValue("Content-Type","application/x-www-form-urlencoded");
header.addValue("Cache-Control", "no-cache");
QString host = parts.first() + "." + GALLERY_HOSTNAME;
http.setHost(host);
header.addValue("Host", host);
header.addValue("Accept","*/*");
QByteArray postdata;
postdata.append(post);
http.request(header, postdata);
}