Question for Gruss - WinHttpRequest

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

Question for Gruss - WinHttpRequest

Postby alrodopial » Mon Dec 08, 2008 11:14 pm

Hi,
Gruss in the RP tissue sheet you posted you are using a UDF "getpage" in which you are using the : "CreateObject("WinHttp.WinHttpRequest.5.1")" instead of the "CreateObject("InternetExplorer.Application")".
Can you explain any diferences,what is this?
Please keep it simple.
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby GaryRussell » Tue Dec 09, 2008 8:12 am

"WinHttp.WinHttpRequest.5.1" just allows you access to the http protocol whereas "InternetExplorer.Application" allows you automate Internet Explorer. You can use both to capture a web page, but if your aim is just to capture the raw html and parse it yourself then "WinHttp.WinHttpRequest.5.1" is a more lightweight and direct way of doing so.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby alrodopial » Thu Jul 28, 2011 3:36 pm

Using the "WinHttp.WinHttpRequest.5.1" method and the ResponseText property I don't get all the info that a page contains.

http://www.livexscores.com/livescore/tennis/inplay (has java)

Using the "CreateObject("InternetExplorer.Application")" method and the innerHTML property I get what I want.

Is there a way doing the same with the "WinHttp.WinHttpRequest.5.1" method?

Thanks

Code: Select all
Private Function getPage(strUrl)
    Dim web
    Const WinHttpRequestOption_EnableRedirects = 6
    Set web = Nothing
    On Error Resume Next
    Set web = CreateObject("WinHttp.WinHttpRequest.5.1")
    If web Is Nothing Then Set web = CreateObject("WinHttp.WinHttpRequest")
    If web Is Nothing Then Set web = CreateObject("MSXML2.ServerXMLHTTP")
    If web Is Nothing Then Set web = CreateObject("Microsoft.XMLHTTP")
    web.Option(WinHttpRequestOption_EnableRedirects) = True
    web.Open "GET", strUrl, False
    web.SetRequestHeader "REFERER", strUrl
    web.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
    web.SetRequestHeader "Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
    web.SetRequestHeader "Accept-Language", "en-us,en;q=0.5"
    web.SetRequestHeader "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
    web.Send
    If web.Status = "200" Then
        getPage = web.ResponseText
    Else
        getPage = ""
    End If
End Function
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby osknows » Thu Jul 28, 2011 10:52 pm

Hello,

You can create document and load it with the response text. Eg

Dim HTMLDoc As HTMLDocument
Set HTMLDoc = New HTMLDocument
HTMLDoc.body.innerHTML = web.ResponseText
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby osknows » Thu Jul 28, 2011 11:28 pm

Also, you can get the live tennis scores directly using

http://www.livexscores.com/xml/tinplay.txt?

where <TIME> is the current timestamp to ensure the page is not cached. Eg

http://www.livexscores.com/xml/tinplay. ... 4778238531
User avatar
osknows
 
Posts: 946
Joined: Wed Jul 29, 2009 12:01 am

Postby alrodopial » Thu Jul 28, 2011 11:48 pm

Thanks Os I'll check your links later tonight , I believe that they will do my job.

For my original question I was saying that with the innerHTML e.g I get :

Code: Select all
 OVERFLOW: hidden">Sweeting Ryan (USA)</DIV></TD>


with the name of a player which I can get but using the responseText I don't get these strings, no player names, no scores.
(somewhere in the string I get it says that "You need Javascript enabled to view live scores"
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby alrodopial » Thu Jul 28, 2011 11:54 pm

osknows wrote:Also, you can get the live tennis scores directly using

http://www.livexscores.com/xml/tinplay.txt?

where <TIME> is the current timestamp to ensure the page is not cached. Eg

http://www.livexscores.com/xml/tinplay. ... 4778238531


<TIME> is written like excel calculates the time? (max 0.99999)
How accurate must be to get the current odds?
I also need the player who is serving which I can get with the innerHTML (it's a gif picture) , does your links provide this info?
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby alrodopial » Fri Jul 29, 2011 12:02 am

The server exists in the info , thanks os It looks that it is what I need.
alrodopial
 
Posts: 1384
Joined: Wed Dec 06, 2006 9:59 pm

Postby forum1 » Mon Oct 03, 2011 2:50 pm

I may need to post my Question as a separate topic, however I am posting it here for now since it may be relevant with what it is discussed in this thread so far (that unfortunately I am not able to fully understand neither I ever attempted to use the RacingPost tissue prices even though i tried to find w/o success what they are).

The next step in developing my current trading strategy is calling for filling (and updating/refreshing) a few cells of my triggering sheet with certain prices. These prices can be found in a table of a certain webpage. This table is in javascript form. Is it possible to do (both fill and update values as they change) so? Is VBA and the "WinHttp.WinHttpRequest.5.1" method the means with which I should try?

Btw, I've managed to achieve the same (fill and refresh prices of my sheet) from an XML table of a webpage.
forum1
 
Posts: 22
Joined: Thu Aug 18, 2011 8:59 pm


Return to Discussion

Who is online

Users browsing this forum: No registered users and 65 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.