We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.7k
Accepted
answer


22.7k

Thanks, I will check it out.

Regards

C



22.7k

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.7k

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