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 ('foo.bar@foobar.com'
)
);
$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 关注
- 122 浏览
添加回答
举报