Skip to content

Instantly share code, notes, and snippets.

@neo22s
Last active November 14, 2016 07:58
Show Gist options
  • Save neo22s/0b500a8e444c2add8197 to your computer and use it in GitHub Desktop.
Save neo22s/0b500a8e444c2add8197 to your computer and use it in GitHub Desktop.
test license for open classifieds
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors', 1);
$license = 'YOURLICENSEHERE';
$api_url = 'https://selfhosted.yclas.com/api/license/'.$license.'/?domain='.$_SERVER['HTTP_HOST'];
die(var_dump(json_decode(curl_get_contents($api_url))));
/*$market_url = 'http://market.open-classifieds.com/api/products';
$market = curl_get_contents($market_url.'?r='.time());
die(var_dump(json_decode($market,TRUE)));*/
/**
* gets the html content from a URL
* @param string $url
* @param integer $timeout seconds to timeout the request
* @return string on success, false on errors
* @return string
*/
function curl_get_contents($url, $timeout = 30)
{
$c = curl_init(); if ($c === FALSE) return FALSE;
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_TIMEOUT,$timeout);
$contents = curl_exec($c);
if( ! curl_errno($c))
{
curl_close($c);
return ($contents)? $contents : FALSE;
}
else
return 'Curl error: ' . curl_error($c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment