Guest User

Untitled

a guest
Jun 21st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. require 'uri'
  2. require 'net/http'
  3.  
  4. URL = 'https://www.scraping-me.com/ok/dude';
  5. uri = URI.parse(URL)
  6. http = Net::HTTP.new(uri.host, uri.port)
  7. http.use_ssl = true
  8. http.set_debug_output($stdout)
  9. request = Net::HTTP::Post.new(uri.path)
  10. request['Content-Length'] = '0'
  11. p http.request(request)
  12.  
  13. opening connection to www.scraping-me.com:443...
  14. opened
  15. starting SSL for www.scraping-me.com:443...
  16. SSL established
  17. <- "POST /ok/dude HTTP/1.1rnAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3rnAccept: */*rnUser-Agent: RubyrnContent-Length: 0rnConnection: closernHost: www.scraping-me.comrnContent-Type: application/x-www-form-urlencodedrnrn"
  18. <- ""
  19. -> "HTTP/1.1 403 Forbiddenrn"
  20. -> "Server: CloudFrontrn"
  21. -> "Date: Thu, 21 Jun 2018 13:23:20 GMTrn"
  22. -> "Content-Type: text/htmlrn"
  23. -> "Content-Length: 560rn"
  24. -> "Connection: closern"
  25. -> "X-Cache: Error from cloudfrontrn"
  26. -> "Via: 1.1 8c17e8fbe0b8e6fb8aa40ba7a7b911d2.cloudfront.net (CloudFront)rn"
  27. -> "X-Amz-Cf-Id: vQZZvIl543OJSbMxkmMWSrpsUFYaZJ6f2VOiAI_CQd8jTAteK8X73Q==rn"
  28. -> "rn"
  29. reading 560 bytes...
  30. -> "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">n<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">n<TITLE>ERROR: The request could not be satisfied</TITLE>n</HEAD><BODY>n<H1>403 ERROR</H1>n<H2>The request could not be satisfied.</H2>n<HR noshade size="1px">nRequest blocked.nn<BR clear="all">n<HR noshade size="1px">n<PRE>nGenerated by cloudfront (CloudFront)nRequest ID: vQZZvIl543OJSbMxkmMWSrpsUFYaZJ6f2VOiAI_CQd8jTAteK8X73Q==n</PRE>n<ADDRESS>n</ADDRESS>n</BODY></HTML>"
  31. read 560 bytes
  32. Conn close
  33. #<Net::HTTPForbidden 403 Forbidden readbody=true>
  34.  
  35. request.instance_eval { @header.delete('user-agent') }
  36.  
  37. request.instance_variable_get(:@header)
Add Comment
Please, Sign In to add comment