Take the 2-minute tour ×

I'm trying to use an API which is over SSL. I'm requesting it with cURL and filling out the POST parameters myself, like so:


$ch = curl_init();

$postFields = array(
    'param1' => 'value1'

curl_setopt($ch, CURLOPT_URL, 'https://url.to/api');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);

$resp = json_decode(curl_exec($ch));


When I run the code, $resp is false which I've confirmed with var_dump($resp). If I add curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); however, I get the following response:

Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 e12sm28230845wiw.5 - gsmtp

After Google'ing the error I came across a blog post which said this can happen when you aren't using SSL correctly. Could this be the case here or is this likely to be the API itself at fault?

share|improve this question
Blame the google :P –  N e w B e e Feb 10 '13 at 18:33
The error message you're getting indicates that you're trying to connect to an SMTP server, not a web server. What is the exact, real value you're passing to CURLOPT_URL? –  duskwuff Feb 10 '13 at 18:36
add comment

Your Answer



Browse other questions tagged or ask your own question.