Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为JSONString Zoho库存api传递的值无效_Php - Fatal编程技术网

Php 为JSONString Zoho库存api传递的值无效

Php 为JSONString Zoho库存api传递的值无效,php,Php,我正在尝试使用zoho inventory api,并将其示例curl代码转换为php中使用的代码 $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,”https://inventory.zoho.com/api/v1/salesorders"); $vars=数组( “authtoken”=>“”, “组织机构id=>”, “JSONString”=>'{ “客户id”:4815000000044080, }' ); 卷曲设置($ch,卷曲设置桩,1);

我正在尝试使用zoho inventory api,并将其示例curl代码转换为php中使用的代码

$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,”https://inventory.zoho.com/api/v1/salesorders");
$vars=数组(
“authtoken”=>“”,
“组织机构id=>”,
“JSONString”=>'{
“客户id”:4815000000044080,
}'
);
卷曲设置($ch,卷曲设置桩,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$vars)//邮政领域
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$headers=[
'授权:Zoho authtoken',
'内容类型:application/json;charset=UTF-8',
];
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
$server\u output=curl\u exec($ch);
echo$server\u输出;
卷曲关闭($ch);
在页面上,我得到了这样的回应

{“code”:4,“message”:“为JSONString传递的值无效”}

文档中的原始代码是

$curlhttps://inventory.zoho.com/api/v1/salesorders?authtoken=ba4604e8e433g9c892e360d53463oec5&organization_id=10234695
-X柱
-H“授权:Zoho authtoken ba4604e8e433g9c892e360d53463oec5”
-H“内容类型:应用程序/json;字符集=UTF-8”
-d JSONString={
“客户id”:4815000000044080,
}'
我尝试过各种谷歌搜索,似乎很多人都遇到过同样的问题,但目前还没有给出答案

我认为我试图以错误的方式添加
JSONString

使用curl在php中发送JSONString的正确方法是什么?

下面是不会给出“{”code“:4,“message”的c#代码:“传递给JSONString的值无效”}”错误

如果您有任何问题,请发邮件给我。"shiva151316@gmail.com“

我使用服务查看我的post查询如何查找zoho。 并在JSONString之前找到符号\ufeff的错误,这是BOM编码。 所以,我改变了编码,好了