to get Facebook API response I do something like:
$url = "https://graph.facebook.com/me/feed";
$data = 'access_token=MY_API_ID&message=Check out this funny article';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $data );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/
plain'));
$result=curl_exec ($ch);
curl_close($ch);
I would avoid to do this in every method that I need. So I would
create a class with that handle this connection, so when I need I can
just write
$fb = new FbApi();
$result = $fb->exec_api('Check out this funny article');
Obviously, API key is stored inside new class.
On 8 Set, 20:05, cricket <[email protected]> wrote:
> On Wed, Sep 8, 2010 at 1:40 PM, Mariano C. <[email protected]> wrote:
> > I get the answers from webservice, throug curl calling. I would wrap
> > these instruction inside a class. So I can create the handle and get
> > the response simply calling the proper method.
>
> > Where I have to put this type of class?
>
> A component, maybe. Your explanation isn't very clear.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en