Results 1 to 3 of 3

Thread: php curl error 403

  1. #1
    Guest

    Default php curl error 403

    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.'&params='.$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?

  2. #2
    Gianluca is offline Administrator
    Join Date
    Feb 2010
    Posts
    512

    Default

    You should go in your AlterVista control panel and enable server to server connection to all the destinations.

  3. #3
    Guest

    Default

    That did it, thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO