Skip to main content
Bhaveshkumar Bhavsar
Fyers Authorized Partner
Asked a question 2 years ago

I am trying to get authorization code in php by REST api post request on "" but I am get an error "{"ERROR": "No JSON object could be decoded"}"

Join FYERS Community to pick others' brains on Trading/Investing

I've had to add these extra curl options for it to work.

$curl = curl_init();

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);


check them.

Encode using json function and use app_id/secret instead of http_build_query()

I don't know where you got button submit and why you are using it.

$step1 = array('app_id'=>'XXXXX', 'secret_key'=>'YYYYY');
$post_str = json_encode( $step1 );


I don't know anything about cUrl I use Java HttpUrlConnection and Okhttp class but got a translation through post man check it works for me to get auth code


curl --location --request POST '' \

--header 'sec-fetch-dest: empty' \

--header 'sec-fetch-mode: cors' \

--header 'sec-fetch-site: same-origin' \

--header 'Content-Type: application/json' \

--data-raw '{



"create_cookie": "False"