Skip to content

Instantly share code, notes, and snippets.

@gsmcwhirter
Forked from anonymous/gist:2362
Created July 25, 2008 02:59
Show Gist options
  • Save gsmcwhirter/2371 to your computer and use it in GitHub Desktop.
Save gsmcwhirter/2371 to your computer and use it in GitHub Desktop.
<?php
$qry_str = 'publisher=9284102052512106';
$url = "http://api.indeed.com/ads/apisearch?". $qry_str . '&q=' . $_GET['q'] . '&l=' . $_GET['l'];
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return into a variable
//curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
//curl_setopt($ch, CURLOPT_POST, true); // set POST method
$result = curl_exec($ch); // run the whole process
if(!$result)
{
echo curl_error($ch);
}
curl_close($ch);
echo $result;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment