We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Consume third party REST API Services

Hi All,

I need some guidance on how to consume 3rd party REST API services. Are there any examples availble? eg. consuming a twitter API service?

If anybody can point me in the right direction I would appreciate it.

Thanks!



40.8k
Accepted
answer


22.8k

Thanks, I will check it out.

Regards

C



22.8k

I cant get Guzzle to work, I followed the instructions but keep on getting :

Fatal error: Class 'Guzzle\Http\Client' not found in C:\localhost\tutorial\app\controllers\IndexController.php on line 12

I even updated composer after editing the composer.json file.

Any ideas?

You either need to bypass the Phalcon autoloader explicitely by include()-ing or require()-ing the Guzzle file, or configure the auto-loader to know where to look.



22.8k

Thanks quasipickle, this worked for me. I had to require() the vendor/autoloader.php file in my index.php and it worked.

Use :

  • Guzzle - A comprehensive HTTP client.
  • Buzz - Another HTTP client.
  • Requests - A simple HTTP library.
  • HTTPFul - A chainable HTTP client.
  • Goutte - A simple web scraper.

https://github.com/lorien/awesome-web-scraping/blob/master/php.md#web-scraping-frameworks