curl exec not working php

Solutions on MaxInterview for curl exec not working php by the best coders in the world

showing results for - "curl exec not working php"
Debora
23 Oct 2018
1$ch = curl_init();
2curl_setopt($ch, CURLOPT_URL, $url);
3curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
4curl_setopt($ch, CURLOPT_PROXY, $proxy); // $proxy is ip of proxy server
5curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
6curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
7curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
8curl_setopt($ch, CURLOPT_TIMEOUT, 10);
9
10$httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE); // this results 0 every time
11$response = curl_exec($ch);
12
13if ($response === false) 
14    $response = curl_error($ch);
15
16echo stripslashes($response);
17
18curl_close($ch);
19