Cosmin
Cosmin

Reputation: 125

Convert cli curl to php

I'm having a cli curl command to purge an image from varnish.

curl -v -k -X PURGE https://www.example.com/assets/image.jpg

How can i convert this to php curl?

I've got so far

$varnish_curl = curl_init($varnish_url);
curl_setopt($varnish_curl, CURLOPT_VERBOSE, TRUE); // -v
curl_setopt($varnish_curl, CURLOPT_CUSTOMREQUEST, "PUT"); // -X
curl_setopt($varnish_curl, CURLOPT_CUSTOMREQUEST, "PURGE");
curl_exec($varnish_curl);
curl_close($varnish_curl);

Can't seem to find any option for -k

Upvotes: 0

Views: 77

Answers (1)

wlalele
wlalele

Reputation: 333

for the -k

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

check it out : php curl -k or --insecure, -X

Upvotes: 1

Related Questions