Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Joshuyo's avatar

How to set CURLOPT_INTERFACE in Laravel HTTP client?

We are using laravel HTTP client to make http requests to communicate with external APIs. Due to IP based rate limitations in some of the external end points, we decided to use different IPs for different requests. Guzzle provides a nice feature (CURLOPT_INTERFACE), which allows you to define outgoing network interface. Anyone can guide us on how to set this parameter in Laravel Http client request.

Thanks in advance...

0 likes
2 replies
s4muel's avatar
s4muel
Best Answer
Level 50

not sure, but i would try this:

$response = Http::withOptions([
    'curl' => [CURLOPT_INTERFACE => 'xxx.xxx.xxx.xxx'],
])->get('http://example.com/users');
2 likes

Please or to participate in this conversation.