I've been dealing with Stand out 2010. I am attempting to send form data with the XMLHTTP object to obtain a web page without luck. The web site I am working from is http://espn.go.com/major league baseball/gamers and I am trying to find a particular player with the searchbox (e.g. Fister). This is actually the source code between your form tags.
<form id="searchBox" title="searchBox" action="http://search.espn.go.com/results" method="get" accept-charset="utf-8" style="color: #999999"> <div class="clearfix"> <input autocomplete="off" class="text" type="text" placeholder="Search" title="searchString" id="searchString" /> <input type="hidden" title="page" id="page" value="null" /> <input type="hidden" title="fromForm" value="true" /> <input class="submit" type="submit" value="" /> </div> </form>
My code to try to perform the search is below.
Sub SearchPlayer() Dim xml As MSXML2.ServerXMLHTTP Dim search, url As String search = "searchString=Fister&page=null&fromForm=true" url = "http://espn.go.com/major league baseball/gamers" Set xml = New MSXML2.ServerXMLHTTP xml.Open "Publish", url, False xml.setRequestHeader "Content-Type", "application/x-world wide web-form-urlencoded" xml.send search MsgBox xml.responseText Set xml = Nothing Finish Sub
This code labored for me personally:
Function SearchPlayer(playerName As String) As String Dim xml As MSXML2.XMLHTTP60 Dim result As String Const BASE_URL As String = "http://search.espn.go.com/results?searchString=title&page=null&fromForm=true" Set xml = CreateObject("MSXML2.XMLHTTP.6.") With xml .Open "GET", Replace(BASE_URL, "title", playerName), False .send Finish With result = xml.responseText SearchPlayer = result Finish Function
(assumes you've MSXML 6. in your system -- msxml6.dll inside your local system32 folder)
As mentioned, the shape utilizes a GET request so you would employ the experience attribute and append the INPUT tags' values onto just one string such as this:
I functionized the Sub to help you refer to it as with various player names to scrape each page. Obviously, you'd require a urlencode function should you expect so that it is known as with player names which have spaces inside them (here's one).