Подсмотрел снифером заголовки, а там сервер возвращает
HTTP/1.x 200 OK
Connection: keep-alive
Date: Fri, 12 Jun 2009 12:23:33 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Set-Cookie: ASP.NET_SessionId=npgggx55k0fx4045kjnyci55; path=/; HttpOnly
Set-Cookie: SessionServerCode=AIIBEG; path=/
Cache-Control: private
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding, User-Agent
Content-Encoding: gzip
Transfer-Encoding: chunked
Вот, что делаю
Code: Select all
wxHTTP get;
//Этот фрагмент обращается успешно к www.188bet.com/Common/Bet188/MenuBet/TopMenu_Bet188.aspx?s11Lang=ENG
//wxInputStream *httpStream = get.GetInputStream(_T("/Common/Bet188/MenuBet/TopMenu_Bet188.aspx?s11Lang=ENG"));
//И даже возвращает Set-Cookie, но только последнее, а надо первое, например, Set-Cookie: ASP.NET_SessionId=npgggx55k0fx4045kjnyci55; path=/; HttpOnly
get.SetHeader(wxT("GET"), wxT("/Common/Bet188/MenuBet/TopMenu_Bet188.aspx?s11Lang=ENG HTTP/1.1"));
get.SetHeader(wxT("Host"), wxT("www.188bet.com"));
get.SetHeader(wxT("User-Agent"), wxT("Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10"));
get.SetHeader(wxT("Accept"), wxT("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"));
get.SetHeader(wxT("Accept-Language"), wxT("ru,en-us;q=0.7,en;q=0.3"));
get.SetHeader(wxT("Accept-Encoding"), wxT("gzip,deflate"));
get.SetHeader(wxT("Accept-Charset"), wxT("windows-1251,utf-8;q=0.7,*;q=0.7"));
get.SetHeader(wxT("Keep-Alive"), wxT("300"));
get.SetHeader(wxT("Referer"), wxT("http://www.188bet.com/en/default.aspx"));
get.SetHeader(_T("Content-Type"), _T("text/html; charset=utf-8"));
// set the data you want to send in the command (or omit if you don't need to send data)
//wxString data=wxT("s11StakeType=RB&s11OddsType=HK&s11ViewType=2&i13MarketType=0&s00SportIDList=0&s00LeagueList=&s00MatchNoList=2009241410&d00DateRefresh=2009-06-11+09%3A50%3A55&i12PageNo=1&i13EMDate=0&pageType=RBHDP&PageNo=");
get.SetTimeout(30); // 10 seconds of timeout instead of 10 minutes ...
// this will wait until the user connects to the internet. It is important in case of dialup (or ADSL) connections
while (!get.Connect(_T("www.188bet.com"))) // only the server, no pages here yet ...
wxSleep(25);
wxApp::IsMainLoopRunning(); // should return true
// use _T("/") for index.html, index.php, default.asp, etc.
wxInputStream *httpStream = get.GetInputStream(_T("/Common/Bet188/MenuBet/TopMenu_Bet188.aspx?s11Lang=ENG"));//Путь от корня
//wxInputStream *httpStream = get.GetInputStream(_T("/Common/Bet188/Odds/OpGetOdds.aspx"));//Путь от корня
//wxMessageBox(wxString(_T(" GetInputStream: ")) );
// wxLogVerbose( wxString(_T(" GetInputStream: ")) << get.GetResponse() << _T("-") << ((resStream)? _T("OK ") : _T("FAILURE ")) << get.GetError() );
// wxMessageBox(get.GetHeader(wxT("Content-Length")));
if (get.GetError() == wxPROTO_NOERR)
{
wxString res;
wxStringOutputStream out_stream(&res);
httpStream->Read(out_stream);
wxMessageBox(get.GetHeader(_T("Set-Cookie")));
}
else
{
wxMessageBox(_T("Unable to connect!"));
}
wxDELETE(httpStream);
get.Close();