/** Test Wookie server connection
  *  @return boolean true if success, otherwise false
  */
 public function Test()
 {
     $ctx = @stream_context_create(array('http' => array('timeout' => 15)));
     $url = $this->getURL();
     if (!empty($url)) {
         $response = new HttpResponse(@file_get_contents($url . 'advertise?all=true', false, $ctx), $http_response_header);
         if ($response->getStatusCode() == 200) {
             $xmlDoc = @simplexml_load_string($response->getResponseText());
             if (is_object($xmlDoc) && $xmlDoc->getName() == 'widgets') {
                 return true;
             }
         }
     }
     return false;
 }
 /**
  * Get property for Widget instance
  * @param WidgetInstance instance of WidgetInstance
  * @param Propety instance of WidgetProperty
  * @return WidgetProperty if request fails, return false;
  * @throws WookieConnectorException, WookieWidgetInstanceException
  */
 public function getProperty($widgetInstance, $propertyInstance)
 {
     $Url = $this->getConnection()->getURL() . 'properties';
     try {
         if (!$widgetInstance instanceof WidgetInstance) {
             throw new Exception\WookieWidgetInstanceException('No Widget instance');
         }
         if (!$propertyInstance instanceof WidgetProperty) {
             throw new Exception\WookieConnectorException('No properties instance');
         }
         $data = array('api_key' => $this->getConnection()->getApiKey(), 'shareddatakey' => $this->getConnection()->getSharedDataKey(), 'userid' => $this->getUser()->getLoginName(), 'widgetid' => $widgetInstance->getIdentifier(), 'propertyname' => $propertyInstance->getName());
         $request = @http_build_query($data);
         if (!$this->checkURL($Url)) {
             throw new Exception\WookieConnectorException("Properties rest URL is incorrect: " . $Url);
         }
         $response = new HttpResponse(@file_get_contents($Url . '?' . $request, false, $this->getHttpStreamContext()), $http_response_header);
         $statusCode = $response->getStatusCode();
         if ($statusCode != 200) {
             throw new Exception\WookieConnectorException($response->headerToString() . '<br />' . $response->getResponseText());
         }
         return new WidgetProperty($propertyInstance->getName(), $response->getResponseText());
     } catch (WookieConnectorException $e) {
         $this->getLogger()->write($e->toString());
     } catch (WookieWidgetInstanceException $e) {
         $this->getLogger()->write($e->toString());
     }
     return false;
 }