PHP

HTTPS PHP CURL REQUEST EXAMPLES

HTTPS CURL REQUEST (A)

01

CURL INIT $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://code-boxx.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

CURL FETCH $result = curl_exec($ch); curl_close($ch);

HTTPS CURL REQUEST (B)

02

VERIFY SSL curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);

NO SSL VERIFICATION (A)

03

CURL INIT $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://code-boxx.com"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

CURL FETCH $result = curl_exec($ch); curl_close($ch);

NO SSL VERIFICATION (B)

04

NO SSL VERIFICATION curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);