This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pull the bandwidth data from the API by server's tracking object ID | |
* | |
*/ | |
$soapClient = SoftLayer_Controller_Action_Helper_SoapClient::getSoapClient('SoftLayer_Hardware_Server', $deviceId); | |
$objectMask = new SoftLayer_Soap_ObjectMask(); | |
$objectMask->metricTrackingObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Pull the bandwidth graph data from the SoftLayer API via a custom graph config object | |
* | |
*/ | |
$metrics = array(); | |
$metric = new SoftLayer_Container_Metric_Data_Type(null); | |
$metric->name = 'url_uptime'; | |
$metric->summaryType = 'publicIn'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$jsonCacheFile = './quickfix.json'; | |
$gimmieFeed = 'https://gimmebar.com/api/v0/public/assets/phpquickfix'; | |
$wgetCmd = 'wget -O'.$jsonCacheFile.' '.$gimmieFeed; | |
// look for the cache file | |
if(!is_file($jsonCacheFile) || (is_file($jsonCacheFile) && filemtime($jsonCacheFile)<strtotime('-1 minute')) ){ | |
// fetch the latest content from gimmiebar | |
exec($wgetCmd); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Testing the RESTfulness of the Index controller | |
Let's see how RESTish this is | |
Scenario: Creating a new User | |
Given that I want to make a new "User" | |
And that the its "name" is "Chris" | |
And I request "/user/index.json" | |
And the response is JSON | |
And the response has a "userId" property | |
And the type of the "userId" property is numeric |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Controller_User extends Controller_Rest | |
{ | |
protected function validateHash() | |
{ | |
$request = file_get_contents('php://input'); | |
$requestHeaders = apache_request_headers(); | |
if (!isset($requestHeaders['X-Auth']) || !isset($requestHeaders['X-Auth-Hash'])) { | |
$this->response('fail!',401); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"behat/behat": ">=2.2.2", | |
"behat/mink" : ">=1.3.2", | |
"guzzle/guzzle": ">=2.0.1", | |
"fabpot/goutte": "*", | |
"behat/sahi-client": "*", | |
"alexandresalome/php-selenium": "*", | |
"facebook/php-webdriver": "*" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// autoload_namespace.php generated by Composer | |
$vendorDir = dirname(__DIR__); | |
$baseDir = dirname(dirname($vendorDir)); | |
return array( | |
'Zend\\Validator' => $vendorDir . '/zendframework/zend-validator/php/', | |
'Zend\\Uri' => $vendorDir . '/zendframework/zend-uri/php/', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Behat\Behat\Exception\ErrorException] | |
Exception has been thrown in "beforeSuite" hook, defined in FeatureContext::initMinkSessions() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$r = new XMLReader(); | |
$r->xml($post); | |
while ($r->read()) { | |
if ($r->nodeType == 10) { | |
$doc = $r->readOuterXML(); | |
// see if we have any entities | |
preg_match_all('#<!ENTITY (.*?)>#ims',$doc,$matches); | |
if (!empty($matches[1])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* When using Guzzle with self-signed certs, something recently changed that makes the | |
* previous manual config no longer work...see below | |
*/ | |
// this no longer works | |
$init = array( | |
'curl.CURLOPT_SSL_VERIFYHOST' => false, | |
'curl.CURLOPT_SSL_VERIFYPEER' => false, |
OlderNewer