开发者

How do I access a web page from Sinatra?

I want to run this PHP script http://db2express/imacs/radek/3.1/rationalTest.php?mode=create fro开发者_开发知识库m Sinatra. Sinatra runs on a different box.

Is there any Sinatra built-in way how to do that?

I know I can use mechanize, just wondering if there is something else to use?


Open-URI will do a good job if all you need to do is retrieve the content of the URL or tickle some job at the other end of the URL.

If you need more control then Net::HTTP or Typhoeus are available.

Both Open-URI and Net::HTTP are part of Ruby's standard installation.

I just want to add further that "HTTParty" is a very good wrapper around "Net::HTTP" (see httparty.rubyforge.org)

Yes, I agree. It's nicely done. I reach for OpenURI first since it's built-in. HTTParty is lighter-weight than Typhoeus so it's nicely positioned between them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜