GithubHelp home page GithubHelp logo

bug in submit_form? about rvest HOT 3 CLOSED

tidyverse avatar tidyverse commented on August 22, 2024
bug in submit_form?

from rvest.

Comments (3)

glfeng318 avatar glfeng318 commented on August 22, 2024

see this demo

> account <- html_session('http://flowingmap.com/admin', verbose())
-> GET /admin HTTP/1.1
-> User-Agent: curl/7.37.1 Rcurl/1.95.4.5 httr/0.6.0
-> Host: flowingmap.com
-> Accept-Encoding: gzip
-> Accept: application/json, text/xml, application/xml, */*
-> 
<- HTTP/1.1 301 Moved Permanently
<- Server: nginx/1.6.2
<- Date: Fri, 02 Jan 2015 14:53:33 GMT
<- Content-Type: text/html; charset=iso-8859-1
<- Content-Length: 236
<- Connection: keep-alive
<- Location: http://flowingmap.com/admin/
<- 
-> GET /admin/ HTTP/1.1
-> User-Agent: curl/7.37.1 Rcurl/1.95.4.5 httr/0.6.0
-> Host: flowingmap.com
-> Accept-Encoding: gzip
-> Referer: http://flowingmap.com/admin
-> Accept: application/json, text/xml, application/xml, */*
-> 
<- HTTP/1.1 302 Found
<- Server: nginx/1.6.2
<- Date: Fri, 02 Jan 2015 14:53:34 GMT
<- Content-Type: text/html; charset=UTF-8
<- Transfer-Encoding: chunked
<- Connection: keep-alive
<- X-Powered-By: PHP/5.3.29
<- Location: http://flowingmap.com/admin/login.php?referer=http%3A%2F%2Fflowingmap.com%2Fadmin%2F
<- Via: 10.67.15.24
<- Set-Cookie: saeut=14.18.29.121.1420210414008286; path=/; max-age=311040000
<- 
-> GET /admin/login.php?referer=http%3A%2F%2Fflowingmap.com%2Fadmin%2F HTTP/1.1
-> User-Agent: curl/7.37.1 Rcurl/1.95.4.5 httr/0.6.0
-> Host: flowingmap.com
-> Accept-Encoding: gzip
-> Referer: http://flowingmap.com/admin/
-> Cookie: saeut=14.18.29.121.1420210414008286
-> Accept: application/json, text/xml, application/xml, */*
-> 
<- HTTP/1.1 200 OK
<- Server: nginx/1.6.2
<- Date: Fri, 02 Jan 2015 14:53:35 GMT
<- Content-Type: text/html; charset=UTF-8
<- Transfer-Encoding: chunked
<- Connection: keep-alive
<- X-Powered-By: PHP/5.3.29
<- Via: 10.67.15.24
<- Content-Encoding: gzip
<- 
> account
<session> http://flowingmap.com/admin/login.php?referer=http%3A%2F%2Fflowingmap.com%2Fadmin%2F
  Status: 200
  Type:   text/html; charset=UTF-8
  Size:   6717
> login = html(account) %>% html_form() %>% .[[1]] %>% set_values(name='username', password='123456')
> login
<form> 'login' (POST http://flowingmap.com/index.php/action/login?_=dcf7a0b9dd08f0dbf56cc2785336a057)
  <input text> 'name': username
  <input password> 'password': ******
  <button submit> '<unnamed>
  <input hidden> 'referer': http://flowingmap.com/admin/
  <input checkbox> 'remember': 1
> account$url
[1] "http://flowingmap.com/admin/login.php?referer=http%3A%2F%2Fflowingmap.com%2Fadmin%2F"
> login$url
[1] "http://flowingmap.com/index.php/action/login?_=dcf7a0b9dd08f0dbf56cc2785336a057"
> XML::getRelativeURL(account$url, login$url)
[1] "http://flowingmap.com/admin/login.php?referer=http%3A%2F%2Fflowingmap.com%2Fadmin%2F"
> XML::getRelativeURL(login$url, account$url)
[1] "http://flowingmap.com/index.php/action/login?_=dcf7a0b9dd08f0dbf56cc2785336a057"

from rvest.

hadley avatar hadley commented on August 22, 2024

Want to do a pull request??

from rvest.

glfeng318 avatar glfeng318 commented on August 22, 2024

yea, i will do a pull request.

from rvest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.