Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CURLOPT_RESOLVE option doesn't work properly with curl php function

I'm trying to execute a curl request using CURLOPT_RESOLVE but I get an error :

Warning: curl_setopt() [function.curl-setopt]: Invalid curl configuration option

This following line set the option :

curl_setopt($ch, CURLOPT_RESOLVE, 'example.com:443:127.0.0.1');

Any idea what's wrong ?

like image 838
Jérémy Aublanc Avatar asked Feb 15 '26 20:02

Jérémy Aublanc


1 Answers

From the php.net doc:

An array of hostname, port, and IP address strings, each element separated by a colon. In the format: array("example.com:80:127.0.0.1")

So you can do that:

curl_setopt($ch, CURLOPT_RESOLVE, ['example.com:443:127.0.0.1']);
like image 59
B. Branchard Avatar answered Feb 17 '26 08:02

B. Branchard