I am trying to make an https post using curl in php and get the following error
URL: /submit.php?function=answer&data=true
Curl failed: Received HTTP code 403 from proxy after CONNECT
Here's my code
PHP Code:
<?php
$spark_url = 'https://api.spark.io/v1/devices/xxxxx/';
$token = 'xxxxx';
$function = urlencode($_REQUEST['function']);
$data = urlencode($_REQUEST['data']);
// Initialize curl
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$spark_url.$function);
curl_setopt($ch,CURLOPT_POST,2);
curl_setopt($ch,CURLOPT_POSTFIELDS,'access_token='.$token.'¶ms='.$data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//execute post
$result = curl_exec($ch);
if ($result === FALSE) {
die("Curl failed: " . curl_error($ch));
}
// Results of post in $result
echo $result;
?>
It worked fine on my WAMP server. Any idea what's going on?