dgo.a
dgo.a

Reputation: 2764

Are there any gems that can parse the output of wget?

Are there any gems that can parse the headers and other info from wget?

I have extra information like:

WARNING: cannot verify localhost's certificate, issued by ‘/C=US/ST=Some-State/O=localhost/OU=localhost/CN=localhost/emailAddress=spam@localhost’:
  Self-signed certificate encountered.
  HTTP/1.1 502 Bad Gateway
  Server: nginx/1.2.6 (Ubuntu)
  Date: Fri, 30 Aug 2013 23:04:54 GMT
  Content-Type: text/html
  Content-Length: 893
  Connection: keep-alive
https://localhost/raise/errors:
2013-08-30 18:04:54 ERROR 502: Bad Gateway.

Afterwards I want to turn it into a Hash.

Upvotes: 0

Views: 298

Answers (1)

the Tin Man
the Tin Man

Reputation: 160581

Instead of using wget, and then trying to parse the headers after the fact, I'd recommend using Curb, which relies on libcurl. Curl is a very good alternate tool for the same sort of tasks, which, because of Curb, integrates nicely with Ruby.

There are other tools too, like Ruby's built-in OpenURI, which gives you access to the headers and supports HTTP and FTP protocols. I also like Typhoeus, and HTTPClient and have used them all at different times.

Upvotes: 1

Related Questions