0

I'm trying to POST data to an external URL using Curl, and am getting the error

Parse error: syntax error, unexpected T_STRING, expecting ')' in send.php on line 8

This is what send.php looks like:

<?php
    // Initialize curl
    $curl = curl_init();

    // Configure curl options
    $opts = array(
        CURLOPT_URL             => 'https://zapier.com/hooks/catch/n/abcd/'
        CURLOPT_RETURNTRANSFER  => true,
        CURLOPT_CUSTOMREQUEST   => 'POST',
        CURLOPT_POST            => 1,
        CURLOPT_POSTFIELDS      => 'guid='+ echo $_POST["guid"]; + '&video_title=' + echo $_POST["video_title"]; + '&email=' + echo $_POST["email"]; 
    );

    // Set curl options
    curl_setopt_array($curl, $opts);

    // Get the results
    $result = curl_exec($curl);

    // Close resource
    curl_close($curl);

    echo $result;
?>

I'm still a noob in php, so any help much appreciated :)

Stepan Parunashvili
  • 2,627
  • 5
  • 30
  • 51

1 Answers1

1

You need to learn how to READ and debug error messages. Everything you needed to solve the problem was in the error message.

Look at line 8 and then look at the end of the line before it.

You are missing a comma to separate items in an array after

CURLOPT_URL             => 'https://zapier.com/hooks/catch/n/abcd/'

Use

CURLOPT_URL             => 'https://zapier.com/hooks/catch/n/abcd/',
Community
  • 1
  • 1
Anigel
  • 3,435
  • 1
  • 17
  • 23