#include #include class VeohSocket : public HttpClientSocket { public: VeohSocket(ISocketHandler& h, const std::string& host) : HttpClientSocket(h), m_host(host) , m_first(false) , m_sz(0) { Open(host, 80); } ////////////////////////////////////////////////////////////////////////////////////////// /*void OnConnect() { Send("GET /index.html HTTP/1.0\r\n"); Send("Host: " + m_host + "\r\n"); Send("\r\n"); }*/ ////////////////////////////////////////////////////////////////////////////////////////// void OnFirst() { } ////////////////////////////////////////////////////////////////////////////////////////// void OnHeader(const std::string& key, const std::string& value) { fprintf(stderr, "%s: %s\n", key.c_str(), value.c_str()); } ////////////////////////////////////////////////////////////////////////////////////////// void OnHeaderComplete() { fprintf(stderr, "\n\n"); } ////////////////////////////////////////////////////////////////////////////////////////// void OnData(const char *buf, size_t sz) { if (1||!m_first) { std::string str = buf; str.resize( sz ); printf("%s", str.c_str()); m_first = true; } m_sz += sz; } ////////////////////////////////////////////////////////////////////////////////////////// void OnDelete() { fprintf(stderr, "Content length: %d\n", m_sz); } ////////////////////////////////////////////////////////////////////////////////////////// std::string MyUseragent() { return ""; } private: std::string m_host; bool m_first; size_t m_sz; }; int main(int argc, char *argv[]) { std::string host = argc > 1 ? argv[1] : "www.alhem.net"; SocketHandler h; VeohSocket sock(h, host); sock.SetMethod("POST"); sock.SetUrl("/service/getMediaInfo.xml?clientGUID=497CD97F-78BF-4FBB-9157-17D1C76328AC&VEOH_GUIDE_AUTH=ZGFuaWVsZGFybXN0cm9uZzoxMjE5ODM0MTU1NjY1OjM4ODAyMjc1NDYzNmJkZTQ2Mjc1ODIxMWFmNWUwZWZk==;&version=3.2.1"); sock.SetHttpVersion("1.1"); sock.AddResponseHeader("Cache-Control","no-cache"); sock.AddResponseHeader("Content-Type","application/xml"); sock.AddResponseHeader("Connection","Keep-Alive"); sock.AddResponseHeader("User-Agent","veoh-3.2.1 service (NT 5.1; IE 7.0.5730.11; en-IS Windows)"); sock.AddResponseHeader("Host", host); sock.AddResponseHeader("Cookie", "VEOH_AUTH_GUIDE=ZGFuaWVsZGFybXN0cm9uZzoxMjE5ODM0MTU1NjY1OjM4ODAyMjc1NDYzNmJkZTQ2Mjc1ODIxMWFmNWUwZWZk==; ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE=RG9udXRHdXk6MTIxODIwMzczOTYwMDoxNDhiZjAwYTBkZGY4OGYwNjRiMzZlNzBkMDU0MzU1MQ=="); //sock.AddResponseHeader("\n\n\n\t\n","\b"); sock.SendRequest(); // sock.Send("\n\n\n\t\n"); h.Add(&sock); while(h.GetCount()) { h.Select(1, 0); } }