How to structure an httr POST request to return site data?

I am having trouble retrieving data from the following website. If I go to long_url through my browser, I can see the table that I want to clear, but if I call the url from R using httr, I either do not receive the data returned to me, or I do not understand how it is returned to me.

base_url <- "http://web1.ncaa.org/stats/exec/records"
long_url <- "http://web1.ncaa.org/stats/exec/records?academicYear=2014&sportCode=MFB&orgId=721"

library(XML)
library(httr)
library(rvest) # devtools::install_github("hadley/rvest")

The results of these POST requests look identical to me,

doc <- POST(base_url, query = list(academicYear = "2014", sportCode = "MFB",
                                         orgId = "721"))
doc <- POST(long_url)

class(doc)

Both POST requests return a status code of 200, and the doc class is "HTMLInternalDocument" and "XMLInternalDocument", which is a regular R object that allows me to clear pages. But then the following rvest and XML functions look empty, although I know there is a table on url.

 table <- html_nodes(doc, css = "td")
 table <- readHTMLTable(doc)

- , httr- ? GET- .

+4
1

, , . httr RCurl . user_agent, GET POST RCurl, NULL, . httr(...). , .

base_url <- "http://web1.ncaa.org/stats/exec/records"
ua       <- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0"
library(httr)
library(XML)
doc <- POST(base_url, 
            query = list(academicYear = "2014", sportCode = "MFB",orgId = "721"),
            user_agent(ua))

html <- content(doc, useInternalNodes=T)
df.list <- readHTMLTable(html)
df      <- df.list[[4]]
head(df)
#    Opponent  Game Date Air ForceScore OppScore  Loc Neutral SiteLocation GameLength Attend
# 1   Colgate 08/31/2013             38       13 Home                               - 32,095
# 2  Utah St. 09/07/2013             20       52 Home                               - 32,716
# 3 Boise St. 09/13/2013             20       42 Away                               - 36,069
# 4   Wyoming 09/21/2013             23       56 Home                               - 35,389
# 5    Nevada 09/28/2013             42       45 Away                               - 24,545
# 6      Navy 10/05/2013             10       28 Away                               - 38,225

, - , readHTMLTable(...) 4- . - , .

rvest.

+6

All Articles