CodeIgniter Forums
Pownce Library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Pownce Library (/thread-7055.html)



Pownce Library - El Forum - 03-22-2008

[eluser]Cyb3rAssasin[/eluser]
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Pownce {
    
    function get_pownce($data, $uid) {
        
        $target = "http://api.pownce.com/1.1/public_note_lists/from/".$data['username'].".xml?limit=1";
        
        $ch = curl_init();
        
        curl_setopt($ch, CURLOPT_URL, $target);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        
        $getpownce = curl_exec($ch);
        
        $pownces = new SimpleXMLElement($getpownce);
        
        foreach ($pownces->note as $pownce) {
            $text = $pownce->body;
            $time = $pownce->display_since;
        }
        
        curl_close($ch);
        
        $presence = array("text"=>htmlspecialchars($text), "date"=>$time, "source"=>'<a href="http://pownce.com/'.$data['username'].'">Pownce</a>');
    
        return $presence;    
        
    }
    
}


?&gt;

Okay I have this pownce library.(I did not write it) I'm not sure how to get it to work, This is what I've tried but I know its not right.
Code:
$params = array('username'=>'theusernamehere');
$this->load->library('pownce',$params);
$data["pownce"] = $this->load->library('pownce',$params);
Can someone shed some light on this for me, or point me in the right direction? Thanks.


Pownce Library - El Forum - 03-22-2008

[eluser]wiredesignz[/eluser]
Code:
$data = array('username'=>'theusernamehere');
$uid = ?

$this->load->library('pownce');

$data["pownce"] = $this->pownce->get_pownce($data, $uid);



Pownce Library - El Forum - 03-23-2008

[eluser]Cyb3rAssasin[/eluser]
hey thanks that got rid of the errors but now im recieving "Array" instead of my pownce note :/ I've tried everything. Maybe im calling it wrong in my view file.
Code:
&lt;?=$pownce;?&gt;



Pownce Library - El Forum - 03-23-2008

[eluser]wiredesignz[/eluser]
$pownce is an array, Just look at the return value from the library.
Code:
$pownce['text'];
$pownce['date'];
$pownce['source'];
This is very basic stuff.


Pownce Library - El Forum - 03-23-2008

[eluser]Cyb3rAssasin[/eluser]
Thanks man you rock! (ps: sorry if i sound noobish :/)