热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用用户输入下载站点主体-Downloadingthebodyofsitesusinguserinput

Iwanttouseshoestobeabletodownloadthebodyofawebsitethatauserentersinanedit_line.

I want to use shoes to be able to download the body of a website that a user enters in an edit_line. How can I make this work? Can anyone help explain why the below code does not work? It just pops up a new window, and does not download the site from the text entered....

我想使用鞋子来下载用户在edit_line中输入的网站的正文。我怎样才能做到这一点?任何人都可以帮助解释为什么下面的代码不起作用?它只是弹出一个新窗口,不会从输入的文本中下载该网站....

Here's my code thus far:

到目前为止,这是我的代码:

Shoes.app do
  stack (:left => 175, :top => 200) do
    para "Enter a url:"
    flow do
      @url = edit_line
      button "OK" do

    window do
        stack do
         title "Searching site", :size => 16
          @status = para "One moment..."
          # Search site for query and print body
            download @url.text do |site|
              @status.text = "Body: " + site.response.body.inspect
            end
         end
       end
     end
   end
 end
 end

1 个解决方案

#1


1  

Nevermind - I figured it out. I just didn't pop to a new window and it downloads and prints the body fine. : )

没关系 - 我明白了。我只是没有弹出一个新窗口,它下载并打印身体罚款。 :)


推荐阅读
author-avatar
宝宝贝贝侠
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有