[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KIO and cookies
From:       Oliver Graf <oliver () knusperkopf ! de>
Date:       2003-04-12 13:31:15
[Download RAW message or body]

Hi everybody,
again, I am messing around with an application which fetches
a HTML page from the web. Unfortunately, the requested page
needs to set a cookie, otherwise I won't get the result I expect.
I receive an error page instead. How can I handle that? My code for
retrieving the page is as follows:

<--cut-->
class MyApp
{
public:
    QString page(const KURL &url);
protected slots:
    void slotResult(KIO::Job *job);
    void slotData(KIO::Job *job, const QByteArray& data);
private:
    QString m_data;
};

QString MyApp::page(const KURL &url)
{
    KIO::Scheduler::checkSlaveOnHold(true);
    KIO::Job *v_job = KIO::get(url,false,false);
    m_data="";
    connect(v_job, SIGNAL(data(KIO::Job*,const QByteArray&)),this, 
SLOT(slotData(KIO::Job*,const QByteArray&)));
    connect(v_job, SIGNAL(result(KIO::Job*)), 
this,SLOT(slotResult(KIO::Job*)));
    kapp->eventLoop()->enterLoop();
    return m_data; 
}

void MyApp::slotResult(KIO::Job *job)
{
    kapp->eventLoop()->exitLoop();
}

void MyApp::slotData(KIO::Job *job, const QByteArray& data)
{
    m_data += data;
}
<--cut-->

Oliver

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic