How to Query Web Services with a Build Script
videos

How to Query Web Services with a Build Script

Tutorial Details

Do you hate that your favorite web service can’t be used in your build scripts? Well, are you sure that’s the case? I’ll show you how to use a popular tool, Phing – which is essentially a port of the popular Apache Ant for PHP – to query the Nettuts+ Prefixr API in today’s quick tip.

Choose 720p for the clearest picture.
Subscribe to our YouTube and Blip.tv channels to watch more screencasts.

Final Sample Phing Project

<?xml version="1.0"?>

<project name="demo" default="prefixr">
	<property name="css.path" value="css/style.css" />
	<target name="prefixr">
		<echo msg="Updating your stylesheet" />
		<loadfile property="css.min" file="${css.path}" />
		<exec command="curl -sSd css='${css.min}' http://prefixr.com/api/index.php > ${css.path}" />
	</target>

</project>

Conclusion

The more I use Phing, the more I realize just how powerful it is. While many prefer Apache Ant for its portability, with Phing, I can use my existing PHP knowledge to create any new tasks or filters that I require. That’s incredibly powerful and convenient. What’s your build tool of choice?

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.dumpomaat.nl Stick

    Great tutorial! But for this purpose I tend to use CSS Crush: http://the-echoplex.net/csscrush/

    It does this on the fly (also caches the file) and has a lot more cool features, check it out :).

  • the doubl

    Great tut!!!

  • alex

    I noticed you’re using Sublime Text2, I wanted to get your thoughts on it.

    BTW- I thought you were sold on VIM what’s up :).

    • http://www.jeffrey-way.com Jeffrey Way
      Author

      Lots of Vim can be ported!

  • http://www.veztekusa.com veztek

    there are very few tutorials which are worth reading and this is one of them

  • http://ashwin.co.in Ashwin

    Nice tutorial Jeff, you have mentioned that there is an phing tutorial on the premium. but i cant find where it is could you please let me know where it is. thanks Jeff

    • http://www.jeffrey-way.com Jeffrey Way
      Author

      Hey Ashwin – It’s actually going up tomorrow! :)

  • http://www.csmdesign.hu Tilos

    Great tut!!! :D

  • http://www.nytogroup.com/ Dan

    Awesome tut! :)

  • Gareth

    Hey Jeffrey, just love your tuts so keep up the good work. I would like to request 2 tutorials from you ( that is if you have the time :) ) if I may.

    1. How would you handle queing? Say you had to loop through a 1000000 records and update them, if would not make sense to use a loop as the server would just time out. The next problem is if so ing did go wrong in loop you would have no idea where it stopped. Maybe something like resque?

    2. How would you handle hierarchy of data? Again looping it has a lot of problems. I think nested set are the way to go but have never used them, do you have any thoughts?

    If you planning to do a tut on these I would love to see it in codegniter.

    Again love you work and training style.

    All the best Gareth

  • http://www.imstillreallybored.com Josh Bedo

    Awesome tutorial a lot of useful information. I’ve also been using CSS Crush.

  • http://temenin.com/akhirnya/ yoyo

    at least i have know where to learn… thank you Jeff!

  • http://www.wacowebdesign.be Danny

    Thats a nice tutorial. Thx. Keep up the good work.

  • http://blog.kormushoff.com David

    Since there’s been a lot more ruby here lately I thought I’d do a quick port into ruby’s rake.

    gist.github.com/1408014

    Check it out. Pretty simple, it mostly does the exact same thing but with a little more verbosity.

  • http://www.spletek.si izdelava spletnih

    Thanx .. I just needed that.