Author Archives:
3-minute Crafty Earring Tidy
Enter the earring tidy, my 3-minute craft project! Take some fabric ( mine is linen, so its easy to put the earrings through ), put into the hoop, trim. Now add earrings!
It would be cool to categorise earrings and embroider in some outlines and labels, but I didn’t bother. This now hangs by my mirror on a piece of string so I can pick it up and get the earrings easily.
Mounting the VMWare Tools Installation CD
mount /dev/cdrom /mnt/
This gives me an error about “You must specify the mount type” or similar. I found that actually you should type:
mount /dev/cdrom
and see the disk appear in /media/cdrom0. Thanks to this article which helped me out (I am pretty sure its the same one that helped me last time we had this problem as well!).
Tinyurl Shortcut in Opera
Opera has a neat little trick (I hear firefox also now has something similar) where you can right-click in any search box, and save the search as a shortcut which you can then use in the address bar. By default this includes google so you can type: g cowsay to do the equivalent of typing “cowsay” into the search box on google.com. I usually add a few more searches to it – and one of them is for tinyurl, using the search string http://tinyurl.com/%s.

So when I see a URL in a chat session, I can just wait for the tinyurl, then type t followed by the 6 or so digits on the end of the tinyurl to get to where I’m going – very handy!
Schedule for PHPNW
Excitement at Ibuildings

(this is us drinking, rather than speaking, obviously)
Back to my ZendCon story. A few weeks ago, my employers Ibuildings announced their PHP Centre of Expertise which we will be building up. Its an initiative to support the wider PHP ecosystem, particularly because so many key PHP community people and contributors are employed at Ibuildings. I’m not usually a big fan of towing the company line on personal blogs, but this story is important to me.
ZendCon finished on the Thursday lunchtime and after a long afternoon hanging around outside and acquiring some really impressive sunburn (English complexion, Californian sunshine, yes I know I should know better!), the Ibuildings people present at ZendCon went out for a meal – with the table booked for one extra person. When Cal Evans walked in the room, I was delighted to see him, and wondered for a moment if he had just popped in for some beer and chatter – but I was completely and wonderfully wrong! Cal is the Chair of the PCE – so he’ll be my colleague within a few weeks!! I have known Cal for perhaps two years now, he’s a great supporter of phpwomen.org and I count him among my personal friends. Having him move halfway round the world to work with Ibuildings on such an exciting project makes me very optimistic at the thought of things to come. This is Cal and I at the conference:

Ibuildings is often recruiting, and it seems like many friends have joined the organisation already. Could anyone looking for a job with Ibuildings please note that we do have a bonus for employees recommending friends … ?
My Sister’s Graduation
I’m also very pleased to have been able to be here to cheer her on and also very pleased that we now have the sequel to a photograph taken at my own graduation day 5 years ago.
Well done, little one!!
Update from ZendCon
For everything else, see the zendcon photos on flickr! http://www.flickr.com/photos/tags/zendcon08
Using curl and PHP to talk to a REST service
If you don’t know about PHP, Rest, or curl, then I recommend you do a little reading around each of those subjects before reading this as its unlikely to make much sense – I’m not including background on these topics as there are better resources elsewhere.
I’ve written about using curl before from the command line, but this example uses PHP’s curl to access the service. This is just a simple example, but hopefully if you are doing something along these lines you can adapt for your needs.
In the example, we set the URL we’d like to call and initialise the curl object to point to that. Then we create an array of post data, and configure curl to use POST to make the request and to use our data array.
$service_url = 'http://example.com/rest/user/';
$curl = curl_init($service_url);
$curl_post_data = array(
"user_id" => 42,
"emailaddress" => '[email protected]',
);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
$curl_response = curl_exec($curl);
curl_close($curl);
$xml = new SimpleXMLElement($curl_response);
We execute the request and capture the response. Health warning: by default curl will echo the response (for reasons that aren’t clear to me), if you want to parse it then you will need to use the CURLOPT_RETURNTRANSFER flag to have curl return the response rather than a boolean indication of success – this fooled me completely for a while, I have no idea why it works this way. As you can see I’ve parsed the resulting XML and my script can then continue with the data it acquired. Depending what you need to do next, you can manipulate the SimpleXMLElement object as you need to.
If you’re working with PHP and services, then hopefully this will get you started, if you have any questions or comments, then please add them below!
PHPNW Update
Tickets will be on sale somewhere around the end of September or beginning of October, and we’re already finalising some of the sponsorships – thanks so much to the companies who are getting involved in the event. So many of them are really adding to the experience as well as just buying advertising space, its giving the event a very special feel. I’m looking forward to seeing at least some of you in Manchester on November 22nd!!



