代码之家  ›  专栏  ›  技术社区  ›  Cesar

如何访问蚂蚁的网页?

  •  1
  • Cesar  · 技术社区  · 15 年前

    ant task get将下载一个HTTP请求。

    如何访问网页并将响应发送到当前日志记录器,并根据响应做出一些决定?

    提前谢谢

    编辑:

    结果是:

      <target name="genera">
    
        <exec executable="curl" outputproperty="webProcess" errorproperty="error"> 
            <arg line="http://web/web.php"/>
        </exec>
    
        <echo message="${webProcess}" />
    
        <condition property="isOk">
           <equals arg1="OK" arg2="${webProcess}"/>
        </condition>
    
        <echo message="${isOk}" />
        <antcall target="doStuffIfOk"  />
     </target>  
    
    2 回复  |  直到 15 年前
        1
  •  1
  •   Christopher Orr    15 年前

    我相信你必须 <exec> 像这样的外部程序 curl wget 要获得这种功能-Ant get 任务似乎只处理基本文件下载。

        2
  •  0
  •   Andreas Kraft Vinod Joshi    15 年前

    执行外部程序有一个小问题:它不能在不同的操作系统平台上工作。您需要区分和支持构建文件中的各种平台,这将变得一团糟。

    看看 ant contrib包中的任务( http://ant-contrib.sourceforge.net/tasks/tasks/post_task.html )它类似于内置 得到 任务,但可以为响应指定属性。

    推荐文章