1 回答

TA貢獻1796條經驗 獲得超4個贊
$url = "https://api.easybill.de/rest/v1/customers";
$data = array(
'first_name' => 'Foo',
'last_name' => 'Bar',
'company_name' => 'FooBar GmbH',
'emails' => array ('[email protected]'
)
);
$postdata = json_encode(array($data));
$accesstoken = "XXXXXXXXXXX";
$headr = array();
$headr[] = 'Content-length: 0';
$headr[] = 'Content-type: application/json';
$headr[] = 'Authorization: Bearer '.$accesstoken;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headr);
$result = curl_exec($ch);
curl_close($ch);
print_r ($result);
來自德國的最誠摯的問候。
- 1 回答
- 0 關注
- 188 瀏覽
添加回答
舉報