I wanted to use bitly-url-shortener (http://www.yiiframework.com/extension/bitly-url-shortener/) to shorten my url. The code that I am using is below,
<?php Yii::app()->bitly->shorten('http://www.betaworks.com')->getResponseData(); ?>
It give me this error,
get_class() expects parameter 1 to be object, string given
D:\_App\buddyshop\protected\extensions\bitly\VGBitly.php(578)
566 */
567 public function getErrorMessage()
568 {
569 return $this->errorMessage;
570 }
571
572 /**
573 * @return array - Convert a SimpleXML object to an array so we
574 * Could safely store it in the cache and retrieve it when needed.
575 */
576 protected function simplexml2array($xml)
577 {
578 if (get_class($xml) == 'SimpleXMLElement')
579 {
580 $attributes = $xml->attributes();
581 foreach($attributes as $k=>$v)
582 {
583 if ($v) $a[$k] = (string) $v;
584 }
585 $x = $xml;
586 $xml = get_object_vars($xml);
587 }
588 if (is_array($xml))
589 {
590 if (count($xml) == 0) return (string) $x; // for CDATA
the error is indicated on line 578.
Any help would be greatly appreciated. Thanks!