Twebclie enhancement

Twebclie enhancement

Postby Davide » Sat Aug 30, 2008 5:06 pm

The modified method above allows retrieving a page from a server with shared IP hosting (but works even with static IP servers) if cPageName starts with "http://", otherwise it works as before (for compatibility reasons).

Code: Select all  Expand view
   METHOD GetPage( cPageName ) INLINE ;   
          ::oSocket:SendData( "GET "+IIf(Upper(Left(cPageName,7))="HTTP://",;
                              cPageName + " HTTP/1.0" + CRLF + "host: " + SubStr(cPageName,8,AT("/",SubStr(cPageName,8)+"/")-1),;
                              "/" + cPageName + " HTTP/1.0") + CRLF + CRLF )


Antonio, could you please update the standard lib ?
Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Sun Aug 31, 2008 6:38 pm

Davide,

Updated, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Davide » Wed Sep 03, 2008 3:02 am

This one is better (correct HTTP/1.1 syntax and user-agent declaration)
Hi,
Davide
Code: Select all  Expand view
   METHOD GetPage( cPageName ) INLINE ;    // *GD*
          ::oSocket:SendData( "GET /"+IIf(Upper(Left(cPageName,7))="HTTP://",;
                                    SubStr(cPageName,AT("/",SubStr(cPageName,8)+"/")+8) + " HTTP/1.1" + CRLF +;
                                           "Host: " + SubStr(cPageName,8,AT("/",SubStr(cPageName,8)+"/")-1) + CRLF +;
                                           "User-Agent: TWebClient/2008.09.03",;
                                    cPageName + " HTTP/1.0") + CRLF + CRLF )
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Thu Sep 04, 2008 11:20 pm

Davide,

Updated, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 77 guests