0

Im trying to post a message on a forum with R (it doesnt require registration).

The form looks like this

session <- html_session("http://brchan.org/test/res/17.html")
form <- read_html(session) %>% html_form()
form[[1]]
<form> 'post' (POST /post.php)
  <input hidden> 'thread': 17
  <input hidden> 'board': test
  <input text> 'email': 
  <input text> 'subject': 
  <input submit> 'post': Responder
  <textarea> 'body' [0 char]
  <input file> 'file': 
  <input text> 'embed': 
  <input checkbox> 'no-bump': 
  <input checkbox> 'spoiler': 
  <input text> 'password': 

Forum requires only text message in textarea or image file. I have tried many ways to fill the form, but all of them failed. For example.

filled_form <- set_values(form[[1]], file = 'test.png')
submit_form(session, filled_form) 
Submitting with 'post'
<session> http://brchan.org/post.php
  Status: 400
  Type:   text/html; charset=UTF-8
  Size:   2257
Warning message:
In request_POST(session, url = url, body = request$values, encode = request$encode,  :
  Bad Request (HTTP 400). 
ZsideZ
  • 89
  • 1
  • 1
  • 9

0 Answers0