Curl Setup

$ch = curl_init($Url);


ini_set(‘display_errors’, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt_array($ch, array(




‘Authorization:Basic’, base64_encode(“$api_key:$secret_key”),//ERROR

‘Content-Type: application/json’


CURLOPT_POSTFIELDS => json_encode($postData)


(other information and details relevant to your question)

Please help me fix this little piece of code, its bringing up this error message
Parse error : syntax error, unexpected ‘:’, expecting ‘)’ in *directory/ on line 30

I can’t find the issue since the piece of code isn’t at least 30 lines long. PHP is asking you to look at line 30 of your code.

Can you please share the contents of line 30?


put a dot here (.) instead of a comma


Line 30 is where I have commented //Error


That’s true, there was a dot I re-edited as I was checking for where the error really comes in

1 Like

@ethernetexplorer and others

One of the things I also often have to tell myself is: “never trust the user”
Don’t take my sentence above in a negative context.

Users often have the whole picture of the problem in their heads and the whole code in front of their eyes,
but the problem is that they often think that only a piece of code will be enough for others to get an answer about the problem.

So you were distracted by the fact that the error is on line 30
because you automatically thought of the code that the user pasted starting from the beginning of the code,
and so you counted and saw that there were only 27 lines and wondered what happened to the code below (which is not published)…

But you didn’t wonder if there might be a code above :slight_smile:

Especially because $Url is not defined - means there must be something above.
I assume that the user did not want to post the code above because $Url contains his domain, etc.

In addition, the user wrote an //error comment on a particular line…
I didn’t immediately take that comment seriously either, because I’m just used to comments explaining some function, so at first I thought it was just some user’s own note.

To conclude - be careful, so that users (unintentionally on their part) do not lead you in the wrong direction.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.