Skip to content

Instantly share code, notes, and snippets.

@DrMabuse23
Created August 13, 2013 11:25
Show Gist options
  • Save DrMabuse23/6220219 to your computer and use it in GitHub Desktop.
Save DrMabuse23/6220219 to your computer and use it in GitHub Desktop.
<?php
/**
* Created by JetBrains PhpStorm.
* User: brewing
* Date: 13.08.13
* Time: 11:04
* To change this template use File | Settings | File Templates.
*/
namespace Api;
use Guzzle\Http\Client;
use Guzzle\Common\Exception\ExceptionCollection;
class Api {
protected $_client;
public function testApi(){
try {
$testClient = new \Guzzle\Service\Client('http://api.wordpress.org/core/version-check/1.6?version=3.6');
return $testClient->get()->send();
} catch (ExceptionCollection $e) {
echo "The following exceptions were encountered:\n";
foreach ($e as $exception) {
echo $exception->getMessage() . "\n";
}
exit('error');
}
}
}
?>
<!DOCTYPE html>
<html>
<?php
$_ = DIRECTORY_SEPARATOR;
require dirname(__FILE__).$_.'..'.$_.'..'.$_.'common'.$_.'lib'.$_.'vendor'.$_.'autoload.php';
require dirname(__FILE__).$_.'..'.$_.'..'.$_.'api'.$_.'Api.php';
?>
<head>
<title>Becklyn Glue</title>
</head>
<body>
<?php
use Api\Api;
$test = new \Api\Api();
//$response = $test->callApi('projects');
$response = $test->testApi();
?>
<pre>
<?php var_dump($response) ?>
</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment