我可以从销售/发票/专业中插入和获取,但我无法更新。它没有给我任何错误,它只是返回 null,没有给我任何 curl 错误,但也没有更新任何内容。
我的获取和插入工作标题如下:
$this->header_data = array(
'Authorization: Bearer ' . $this->access_token,
'x-myobapi-cftoken: ' . $this->CfToken,
'x-myobapi-key: ' . $this->ClientId,
'x-myobapi-version: v2'
);
我的卷曲如下:
$temp_file = tmpfile();
$json_data = json_encode($data);
fwrite($temp_file, $json_data);
fseek($temp_file, 0);
var_dump($json_data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->header_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_INFILE, $temp_file);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($json_data));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
$decoded_result = json_decode($result);
echo "curl errno: ";
var_dump(curl_error($ch));
echo "\n curl info: ";
var_dump(curl_getinfo($ch));
fclose($temp_file);
return $decoded_result;
我的json数据如下:
{
"Date": "2016-09-15 00:13:32",
"Customer": {
"UID": "1e75e4d0-61af-4c40-bd01-16041719c773"
},
"Lines": [
{
"Total": "100",
"Description": "wc id - 8443:Membership member",
"TaxCode": {
"UID": "54c69a03-032d-4d93-a8df-90a04b20548f"
},
"Account": {
"UID": "4dc0e4dd-73a5-476e-838e-acafbba6e63f"
},
"Date": "2016-09-15 00:13:32",
"Job": {
"UID": "bf95e411-956a-4431-8cab-5a82d590bea4"
},
"RowID": 1143,
"RowVersion": "-8806226121369583616"
}
],
"CustomerPurchaseOrderNumber": "WC-8443",
"Status": "Open",
"UID": "69e6354e-b9b7-4744-851d-a0fb75dc4bfa",
"RowVersion": "-9094456497521295360"
}
查看 Lines RowID,这似乎是错误的,因为它需要 32 个字符但它只有 4 个字符,但我是从现有记录中获取的,所以应该没问题。var_dump 没有显示 curl_error。所以我正在使用getinfo。结果如果 var_dump 如下:
curl errno: string(0) ""
curl info: array(26) {
["url"]=>
string(100) "https://ar1.api.myob.com/accountright/35b87d7b-d79a-4539-a060-6f20f56d8340/Sale/Invoice/Professional"
["content_type"]=>
NULL
["http_code"]=>
int(404)
["header_size"]=>
int(506)
["request_size"]=>
int(1230)
["filetime"]=>
int(-1)
["ssl_verify_result"]=>
int(0)
["redirect_count"]=>
int(0)
["total_time"]=>
float(0.346163)
["namelookup_time"]=>
float(0.012373)
["connect_time"]=>
float(0.030841)
["pretransfer_time"]=>
float(0.071112)
["size_upload"]=>
float(830)
["size_download"]=>
float(0)
["speed_download"]=>
float(0)
["speed_upload"]=>
float(2397)
["download_content_length"]=>
float(0)
["upload_content_length"]=>
float(830)
["starttransfer_time"]=>
float(0.089799)
["redirect_time"]=>
float(0)
["redirect_url"]=>
string(0) ""
["primary_ip"]=>
string(14) "54.252.117.213"
["certinfo"]=>
array(0) {
}
["primary_port"]=>
int(443)
["local_ip"]=>
string(13) "223.27.16.227"
["local_port"]=>
int(60100)
}
我已经在 myob 社区发布了同样的内容,但还没有人回复。任何人都可以帮助它有什么问题?