public static function loadJsonResponse($url)
 {
     $response = Url::get($url);
     if ($response) {
         $json = json_decode($response, true);
         return $json;
     }
 }
 /**
  * Returns an array of owner names for this location
  *
  * @param string $location
  * @return array
  */
 public static function getOwnerNames($location)
 {
     $output = array();
     $location = urlencode($location);
     $url = RENTAL_SERVICE . "?streetAddress={$location}&type=xml";
     $xml = simplexml_load_string(Url::get($url));
     $owners = $xml->xpath("//Owner");
     if (count($owners)) {
         foreach ($owners as $owner) {
             $output[] = $owner->Name;
         }
     }
     return $output;
 }
 public function index()
 {
     if (!empty($_GET['wt']) && $_GET['wt'] == 'json') {
         header('Content-type: text/json; charset=utf-8');
     } else {
         header('Content-type: text/xml; charset=utf-8');
     }
     $protocol = SOLR_SERVER_PORT == 443 ? 'http://' : 'http://';
     $url = $protocol . SOLR_SERVER_HOSTNAME;
     if (SOLR_SERVER_PORT != 80) {
         $url .= ':' . SOLR_SERVER_PORT;
     }
     $url .= SOLR_SERVER_PATH . '/select?' . $_SERVER['QUERY_STRING'];
     echo Url::get($url);
     exit;
 }
 /**
  * Loads an entry from the LDAP server for the given user
  *
  * @param array $config
  * @param string $username
  */
 public function __construct($username)
 {
     global $DIRECTORY_CONFIG;
     $this->config = $DIRECTORY_CONFIG['Employee'];
     $response = Url::get($this->config['DIRECTORY_SERVER'] . '/people/view?format=json;username='******'Employee/unknownUser');
         }
         if (!empty($this->entry->errors)) {
             throw new \Exception($this->entry->errors[0]);
         }
     } else {
         throw new \Exception('Employee/unknownUser');
     }
 }
 /**
  * @param string $address
  * @return SimpleXMLElement
  */
 public static function parseAddress($address)
 {
     if (defined('ADDRESS_SERVICE')) {
         $url = new Url(ADDRESS_SERVICE . '/addresses/parse.php');
         $url->format = 'xml';
         $url->address = $address;
         return simplexml_load_string(Url::get($url));
     }
 }
Example #6
0
 public function testUrlWithoutScheme()
 {
     $url = new Url('bloomington.in.gov/test');
     $this->assertEquals('http', $url->getScheme());
     $this->assertEquals('http://bloomington.in.gov/test', "{$url}");
 }
 public function testUrlWithPort()
 {
     $url = new Url('ftp://bloomington.in.gov:20');
     $this->assertEquals('ftp://bloomington.in.gov:20', $url->__toString());
 }