Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created April 26, 2011 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaindooley/941876 to your computer and use it in GitHub Desktop.
Save iaindooley/941876 to your computer and use it in GitHub Desktop.
Example Decal API search more query
<?php
require_once('curl_request.class.php');
//update this to point to your install
$url = 'http://www.decalcms.com/index.php?h=DecalApi';
$api_key = '597990c64261faa854805f6366f9dcc4f505ed0e';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
'search_more' => 'true',//returns more results than "search"
'list' => '1', //we'll get the first list of results
'numitems' => '10',//let's get 10 results per list
'search_term' => 'decal interactive mockups',//let's get 10 results per list
);
//send off the request using the CurlRequest class
$xml = simplexml_load_string(CurlRequest::toUrl($url)
->method(CurlRequest::POST)
->postFields($fields)
->execute());
foreach($xml->page as $p)
echo '<a href="'.$p['url'].'">'.$p['title'].'<a/><br />'.PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment