Help JSON api coding data pullout

#1

Hello, can anyone help with this code, i’m trying to pullout data from the other website using JSON api, Can anyone spot the problem with the code?

<?php
 $goods_sn = 'DDFF0001';
//$goods_sn = array('DDFF0001','DDFF0002');
//$goods_sn = 'DDFF0001,DDFF0002';
$post_data = array(
'token' => 'your access token',
'goods_sn' => json_encode($goods_sn)
 );
$api_url='https://testapi.testweb.com/v2/user/login';
$curl = curl_init($api_url);
 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
$result = curl_exec($curl);
print_r($result);
curl_close($curl);
?>
#3

There is no $post_data defined in what you posted.