Example #1
0
 public function disabled_testWrongKey()
 {
     global $api_key, $secret_key;
     $mm = new JLD_MindMeister($api_key, 'secret_key');
     $r = $mm->getfrob();
     $this->assertEquals($r instanceof JLD_MindMeister_err, true);
 }
Example #2
0
 public function execute()
 {
     $obj = parent::execute();
     if (isset($obj->frob)) {
         return JLD_MindMeister::factory('frob', $obj);
     }
     if ($obj instanceof JLD_MindMeister_err) {
         return $obj;
     }
     throw new Exception("unknown return code");
 }
Example #3
0
 protected function doRequest(&$url)
 {
     $request =& new HTTP_Request($url);
     $request->_timeout = 5;
     // REDIRECTS are a requirement
     $request->_allowRedirects = false;
     $request->setMethod("GET");
     try {
         $exception = false;
         $code = $request->sendRequest();
     } catch (Exception $e) {
         $exception = true;
     }
     if (PEAR::isError($code) || $exception) {
         return false;
     }
     $this->rep_headers = $request->getResponseHeader();
     $this->rep_body = $request->getResponseBody();
     $this->rep_code = $request->getResponseCode();
     if ($this->rep_code != 200) {
         return $this->rep_code;
     }
     $o = simplexml_load_string($this->rep_body);
     if (!is_object($o)) {
         throw new Exception("network error");
     }
     if (isset($o->err)) {
         return JLD_MindMeister::factory('err', $o);
     }
     return $o;
 }