2
我想写一个比较两个文件内容的方法。我如何加载外部网址/ Internet文件?如何将文件从Internet加载到方法中?
其中一个文件在我的应用程序中,我使用下面的行加载它,这似乎工作。
file1 = File.open('app/assets/files/example.html')
但第二个文件是在互联网上。下面这行加载文件失败(错误:No such file or directory @ rb_sysopen
)。我怎么能加载我的比较方法的Internet文件/页面?
file2 = File.open('http://www.example.com/example.html')
'需要“开uri''通过。然后'file2 = open(“http:// ....”)'' – mike