Skip to content

Commit

Permalink
Simplified check environment script
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmaron committed Nov 10, 2011
1 parent 2238faa commit ef0050d
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions demos/Zend/Service/LiveDocx/check-environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Bootstrap.php';

use Zend\Version;
use Zend\Http\Client as HttpClient;
use Zend\Service\LiveDocx\MailMerge;
use Zend\Service\LiveDocx\Helper;

Expand All @@ -21,16 +20,6 @@

// -----------------------------------------------------------------------------

$httpClientOptions = array(
'maxredirects' => 3,
'timeout' => 5, // seconds
'keepalive' => false
);

$httpClient = new HttpClient(null, $httpClientOptions);

// -----------------------------------------------------------------------------

$failed = false;
$counter = 1;

Expand Down Expand Up @@ -194,20 +183,16 @@

// -----------------------------------------------------------------------------

$httpClient->setUri(GEOIP_SERVICE_URI);

$httpResponse = $httpClient->request();

if ($httpResponse->isSuccessful()) {
$results = @file_get_contents(GEOIP_SERVICE_URI);

if (false != $results) {
$keys = array(
'Ip' => 'IP address',
'City' => 'city',
'RegionName' => 'region',
'CountryName' => 'country'
);

$simplexml = new SimpleXMLElement($httpResponse->getBody());
$simplexml = new SimpleXMLElement($results);
foreach ($keys as $key => $value) {
Helper::printLineToc($counter, sprintf('Checking your %s (%s)', $keys[$key], $simplexml->$key), TEST_PASS);
$counter++;
Expand All @@ -221,9 +206,9 @@

$microtime = microtime(true);

$httpClient->setUri(MailMerge::WSDL);
$results = @file_get_contents(MailMerge::WSDL);

if ($httpClient->request()->isSuccessful()) {
if (false != $results) {
$duration = microtime(true) - $microtime;
$result = TEST_PASS;
} else {
Expand Down Expand Up @@ -286,9 +271,9 @@

$microtime = microtime(true);

$httpClient->setUri(DEMOS_ZEND_SERVICE_LIVEDOCX_PREMIUM_WSDL);
$results = @file_get_contents(DEMOS_ZEND_SERVICE_LIVEDOCX_PREMIUM_WSDL);

if ($httpClient->request()->isSuccessful()) {
if (false != $results) {
$duration = microtime(true) - $microtime;
$result = TEST_PASS;
} else {
Expand Down

0 comments on commit ef0050d

Please sign in to comment.