0
<?php
session_start();
header('Content-type: application/json');
$email = "XXXX";
$password = "XXX";
$serviceId = 4728;
$url = 'https://login.globo.com/api/authentication';
$jsonAuth = array(
'captcha' => '',
'payload' => array(
'email' => $email,
'password' => $password,
'serviceId' => $serviceId
)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($jsonAuth));
$result = curl_exec($ch);
$obj=json_decode($result);
echo "id: " . $obj->{'glbId'};
?>
My code is this, when running in the browser appears the error: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Anyone can help?
Thank you. I got it
– Tássio
Tassio can you please mark the answer as correct, just so you signal that the question has been answered.
– Lucas