Reputation: 4166
I need to call API through HTTP request with custom headers and custom HTTP verb
PUT: http://www.example.com/system/get_user_categories/format/json/user_id/**10**
I guess I need to use:
request::create
But I don't know how.
Upvotes: 0
Views: 145
Reputation: 3894
For this task you can use "Guzzle" PHP-HTTP-Client.
To send requests GET,POST,PUT,DELETE ...
http://guzzle.readthedocs.org/en/latest/http-messages.html#requests
http://guzzle.readthedocs.org/en/latest/clients.html#sending-requests
For custom headers see:
http://guzzle.readthedocs.org/en/latest/http-messages.html#headers
Guzzle is powerfull and easy to use AND there are a lot of "copy-paste" examples you can try out :)
Symfony2 Guzzle composer-package:
https://packagist.org/packages/guzzle/guzzle
Upvotes: 1
Reputation: 39389
Laravel’s request object simply extends Symfony’s HTTP request class (and adds a few Laravel-specific methods), so anything you could do with Symfony\Component\HttpFoundation\Request
you can do with Laravel’s request class.
You’re right in that you can use Request::create()
. See this section in the Symfony documentation: http://symfony.com/doc/current/components/http_foundation/introduction.html#simulating-a-request
Upvotes: 0