Exemplo n.º 1
0
 public static function loadJsonResponse($url)
 {
     $response = Url::get($url);
     if ($response) {
         $json = json_decode($response, true);
         return $json;
     }
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 /**
  * 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');
     }
 }
Exemplo n.º 5
0
 /**
  * @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));
     }
 }
Exemplo n.º 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}");
 }
Exemplo n.º 7
0
 public function testUrlWithPort()
 {
     $url = new Url('ftp://bloomington.in.gov:20');
     $this->assertEquals('ftp://bloomington.in.gov:20', $url->__toString());
 }