Skip to content

Instantly share code, notes, and snippets.

@andrewwatson
Created September 19, 2014 03:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewwatson/1d2f1e2ff1b336408162 to your computer and use it in GitHub Desktop.
Save andrewwatson/1d2f1e2ff1b336408162 to your computer and use it in GitHub Desktop.
Respond to Twilio SMS with a random cat photo
<?php
$xml = new SimpleXmlElement(file_get_contents("http://thecatapi.com/api/images/get?format=xml&results_per_page=1&size=small"));
$cat_picture = $xml->data->images[0]->image->url;
?>
<Response>
<Message>
<Body>Meow!</Body>
<Media><?php echo $cat_picture; ?></Media>
</Message>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment