tags:

views:

46

answers:

2

Ant task GET will download an http request.

How can i visit a webpage and throw the response to the current logger, and maybe take some decition according to the response?

Thanks in advance

Edit:

It worked out like:

  <target name="genera">

    <exec executable="curl" outputproperty="webProcess" errorproperty="error"> 
        <arg line="http://web/web.php"/&gt;
    </exec>

    <echo message="${webProcess}" />

    <condition property="isOk">
       <equals arg1="OK" arg2="${webProcess}"/>
    </condition>

    <echo message="${isOk}" />
    <antcall target="doStuffIfOk"  />
 </target>  
+1  A: 
Christopher
Thanks, it worked with curl, exec and some conditions
Cesar
A: 

There is a small problem with executing an external program: it will not work on different OS platforms. You'll need to distinguish and support the various platforms in the build file, and this will become a mess.

Have a look at the POST task in the ant-contrib package (http://ant-contrib.sourceforge.net/tasks/tasks/post_task.html). It is similar to the build-in GET task, but you can specify a property for the response.

akr