Ecwid订单 - JSON输出问题 [英] Ecwid Order - json output issue

查看:225
本文介绍了Ecwid订单 - JSON输出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与Ecwid一个电子商务商店工作。
http://developers.ecwid.com/api-documentation#orders

使用下面卷曲第一显示数据,但数据被不同地出来大于提供原始

在浏览器中仅使用HTTPS地址 JSON:

<$p$p><$c$c>{\"total\":2,\"count\":2,\"offset\":0,\"limit\":100,\"items\":[{\"vendorOrderNumber\":\"0137062\",\"subtotal\":79,\"total\":138.65,\"email\":\"annaschutt@hotmail.com\",\"externalTransactionId\":\"96U34224JE632150D\",\"paymentModule\":\"PayPalStandard\",\"paymentMethod\":\"PayPal /信用Card\",\"tax\":0,\"ipAddress\":\"80.217.64.221\",\"couponDiscount\":0,\"paymentStatus\":\"PAID\",\"paymentMessage\":\"Your订单已approved\",\"fulfillmentStatus\":\"AWAITING_PROCESSING\",\"orderNumber\":7062,\"refererUrl\":\"fbtab:https://www.facebook.com/fvhardmerchandise/?sk=app_251458316228\",\"orderComments\":\"If其可能获得来自队长的签名和机组人员我的丈夫艾玛迪斯这将是巨大的。他只是爱在电视上显示,也是在这里瑞典渔民&LT; BR&GT;&LT; BR&GT;谢谢you<br>Anna\",\"volumeDiscount\":0,\"customerId\":24198510,\"membershipBasedDiscount\":0,\"totalAndMembershipBasedDiscount\":0,\"discount\":0,\"usdTotal\":138.65,\"globalReferer\":\"https://staticxx.facebook.com/platform/page_proxy/r/hv09mZVdEP8.js\",\"createDate\":\"2016-01-08 14点00分二十零秒+0000,updateDate:2016年1月8日14时04分15秒+0000\",\"createTimestamp\":1452261620,\"updateTimestamp\":1452261855,\"items\":[{\"id\":69399848,\"productId\":51555117,\"categoryId\":2455976,\"price\":40,\"productPrice\":40,\"sku\":\"00604\",\"quantity\":1,\"shortDescription\":\"Royal蓝色长袖衬衫技术!终于,从冠军长袖衬衫高科技!这100%的球衣衬衫有限公...,税:0,发货:17.28985507246377,quantityInStock:23日,名:长袖硬商品技术Shirts\",\"isShippingRequired\":true,\"weight\":2,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499571.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499574.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false,\"selectedOptions\":[{\"name\":\"Size\",\"value\":\"X-Large\",\"valuesArray\":[\"X-Large\"],\"type\":\"CHOICE\"}]},{\"id\":69399849,\"productId\":15479536,\"categoryId\":2455976,\"price\":20,\"productPrice\":20,\"sku\":\"00096\",\"quantity\":1,\"shortDescription\":\"Hard商品帽子在这里!球迷喜爱的硬专卖品标志的特点是在白色上经典的黑色帽子我们两个的...,税:0,发货:10.373913043478261,quantityInStock:211,名:棒球Hat\",\"isShippingRequired\":true,\"weight\":1.2,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111412.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111415.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false},{\"id\":69399850,\"productId\":37228667,\"categoryId\":2455976,\"price\":15,\"productPrice\":15,\"sku\":\"30701\",\"quantity\":1,\"shortDescription\":\"The项目你都被要求!妖兽酷船长的马克杯!咖啡固体14盎司或您喜爱的其他热点beve ......,税:0,发货:30.257246376811594,quantityInStock:104,名:队长的咖啡Mugs\",\"isShippingRequired\":true,\"weight\":3.5,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456142.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456146.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false,\"selectedOptions\":[{\"name\":\"Coffee杯,值:尺码,values​​Array:一Size\"],\"type\":\"CHOICE\"}]},{\"id\":69399851,\"productId\":46912544,\"categoryId\":2455976,\"price\":2,\"productPrice\":2,\"sku\":\"00421\",\"quantity\":1,\"shortDescription\":\"Gut金枪鱼标语。装饰你的汽车,卡车,渔船,储物柜,书桌,打印机或任何漂浮哟......,税:0,发货:0.8644927536231884,quantityInStock:59,名:标语 - 肠道Tuna\",\"isShippingRequired\":true,\"weight\":0.1,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972272.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972274.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false},{\"id\":69399852,\"productId\":46912548,\"categoryId\":2455976,\"price\":2,\"productPrice\":2,\"sku\":\"00423\",\"quantity\":1,\"shortDescription\":\"Wicked硬商品标语。装饰你的汽车,卡车,渔船,储物柜,书桌,打印机或世界卫生大会...,税:0,发货:0.8644927536231884,quantityInStock:44,名:标语 - 妖兽硬Merchandise\",\"isShippingRequired\":true,\"weight\":0.1,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097549.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097553.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false}],\"billingPerson\":{\"name\":\"Anna舒特,的companyName:,街头:Brunskogsbacken 94 \\ N3 tr\",\"city\":\"Farsta\",\"country$c$c\":\"SE\",\"countryName\":\"Sweden\",\"postal$c$c\":\"12371\",\"stateOrProvince$c$c\":\"AB\",\"stateOrProvinceName\":\"Stockholm\",\"phone\":\"0046707340555\"},\"shippingPerson\":{\"name\":\"Anna舒特,的companyName:,街头:Brunskogsbacken 94 \\ N3 tr\",\"city\":\"Farsta\",\"country$c$c\":\"SE\",\"countryName\":\"Sweden\",\"postal$c$c\":\"12371\",\"stateOrProvince$c$c\":\"AB\",\"stateOrProvinceName\":\"Stockholm\",\"phone\":\"0046707340555\"},\"shippingOption\":{\"shippingCarrierName\":\"U.S.P.S.\",\"shippingMethodName\":\"U.S.P.S.优先邮件INTERNATIONAL®,shippingRate:59.65,estimatedTransitTime:6-10},handlingFee:{名:处理Fee\",\"value\":0,\"description\":\"\"},\"additionalInfo\":{},\"paymentParams\":{},\"hidden\":false},{\"vendorOrderNumber\":\"0137061\",\"subtotal\":38.95,\"total\":45.3,\"email\":\"Donnar544@comcast.net\",\"externalTransactionId\":\"5GS82233RB608634T\",\"paymentModule\":\"PayPalStandard\",\"paymentMethod\":\"PayPal /信用Card\",\"tax\":0,\"ipAddress\":\"73.130.161.92\",\"couponDiscount\":0,\"paymentStatus\":\"PAID\",\"paymentMessage\":\"Your订单已approved\",\"fulfillmentStatus\":\"AWAITING_PROCESSING\",\"orderNumber\":7061,\"refererUrl\":\"http://fvhardmerchandise.com/shop.html\",\"volumeDiscount\":0,\"customerId\":24198242,\"membershipBasedDiscount\":0,\"totalAndMembershipBasedDiscount\":0,\"discount\":0,\"usdTotal\":45.3,\"globalReferer\":\"http://www.bing.com/search?q=wicked+tuna+hard+merchandise&qs=RI&pq=wicked+tuna+merchandise&sk=AS1&sc=5-23&sp=2&cvid=7A53D47A788E49C39B6DC837AE8D3E82&FORM=QBLH&ghc=1\",\"createDate\":\"2016-01-08 1点10分十八秒+0000,updateDate:2016年1月8日1点12分07秒+0000\",\"createTimestamp\":1452215418,\"updateTimestamp\":1452215527,\"items\":[{\"id\":69376148,\"productId\":35290579,\"categoryId\":2455976,\"price\":14.95,\"productPrice\":14.95,\"sku\":\"00275\",\"quantity\":1,\"shortDescription\":\"Its终于来了 - 一个项目很多,你一直在等待!该上尉亚诺摇头于生活的色彩,以保持哟......,税:0,发货:3.0078947368421054,quantityInStock:195,名:上尉。马西亚诺Bobblehead\",\"isShippingRequired\":true,\"weight\":0.9,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187919.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187923.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false},{\"id\":69376149,\"productId\":35271535,\"categoryId\":2455976,\"price\":24,\"productPrice\":24,\"sku\":\"00351\",\"quantity\":1,\"shortDescription\":\"This从硬商品略微重新设计的衬衫现在已经在他们真棒WHI背面的CUDA品牌标识刀......,税:0,发货:3.3421052631578942,quantityInStock:71,名:高科技面料硬商品之友Shirt\",\"isShippingRequired\":true,\"weight\":1,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266743.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266748.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false,\"selectedOptions\":[{\"name\":\"Size\",\"value\":\"X-Large\",\"valuesArray\":[\"X-Large\"],\"type\":\"CHOICE\"}]}],\"billingPerson\":{\"name\":\"Dale E查阅SR,的companyName:,街头:544棕榈城公园,城市:Annville,全国code:美国,国家名称:美国States\",\"postal$c$c\":\"17003\",\"stateOrProvince$c$c\":\"PA\",\"stateOrProvinceName\":\"Pennsylvania\",\"phone\":\"7176754357\"},\"shippingPerson\":{\"name\":\"Dale E查阅SR,的companyName:,街头:544棕榈城公园,城市:Annville,全国code:美国,国家名称:美国States\",\"postal$c$c\":\"17003\",\"stateOrProvince$c$c\":\"PA\",\"stateOrProvinceName\":\"Pennsylvania\",\"phone\":\"7176754357\"},\"shippingOption\":{\"shippingCarrierName\":\"U.S.P.S.\",\"shippingMethodName\":\"U.S.P.S.优先邮件2日™,shippingRate:6.35,estimatedTransitTime:1-3},handlingFee:{名:手续费,值:0,说明: },additionalInfo:{},paymentParams:{},隐藏:假}]}

通过PHP使用curl在浏览器中显示JSON:

 字符串(8820) \"{\"total\":2,\"count\":2,\"offset\":0,\"limit\":100,\"items\":[{\"vendorOrderNumber\":\"0137062\",\"subtotal\":79,\"total\":138.65,\"email\":\"annaschutt@hotmail.com\",\"externalTransactionId\":\"96U34224JE632150D\",\"paymentModule\":\"PayPalStandard\",\"paymentMethod\":\"PayPal /信用Card\",\"tax\":0,\"ipAddress\":\"80.217.64.221\",\"couponDiscount\":0,\"paymentStatus\":\"PAID\",\"paymentMessage\":\"Your订单已approved\",\"fulfillmentStatus\":\"AWAITING_PROCESSING\",\"orderNumber\":7062,\"refererUrl\":\"fbtab:https://www.facebook.com/fvhardmerchandise/?sk=app_251458316228\",\"orderComments\":\"If其可能获得来自队长的签名和机组人员我的丈夫艾玛迪斯这将是巨大的。他就喜欢上电视节目,也是这里的渔民在瑞典。谢谢
Anna\",\"volumeDiscount\":0,\"customerId\":24198510,\"membershipBasedDiscount\":0,\"totalAndMembershipBasedDiscount\":0,\"discount\":0,\"usdTotal\":138.65,\"globalReferer\":\"https://staticxx.facebook.com/platform/page_proxy/r/hv09mZVdEP8.js\",\"createDate\":\"2016-01-08 14点00分二十零秒+0000,updateDate:2016年1月8日14时04分15秒+0000\",\"createTimestamp\":1452261620,\"updateTimestamp\":1452261855,\"items\":[{\"id\":69399848,\"productId\":51555117,\"categoryId\":2455976,\"price\":40,\"productPrice\":40,\"sku\":\"00604\",\"quantity\":1,\"shortDescription\":\"Royal蓝色长袖衬衫技术!终于,从冠军长袖衬衫高科技!这100%的球衣衬衫有限公...,税:0,发货:17.28985507246377,quantityInStock:23日,名:长袖硬商品技术Shirts\",\"isShippingRequired\":true,\"weight\":2,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499571.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499574.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false,\"selectedOptions\":[{\"name\":\"Size\",\"value\":\"X-Large\",\"valuesArray\":[\"X-Large\"],\"type\":\"CHOICE\"}]},{\"id\":69399849,\"productId\":15479536,\"categoryId\":2455976,\"price\":20,\"productPrice\":20,\"sku\":\"00096\",\"quantity\":1,\"shortDescription\":\"Hard商品帽子在这里!球迷喜爱的硬专卖品标志的特点是在白色上经典的黑色帽子我们两个的...,税:0,发货:10.373913043478261,quantityInStock:211,名:棒球Hat\",\"isShippingRequired\":true,\"weight\":1.2,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111412.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111415.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false},{\"id\":69399850,\"productId\":37228667,\"categoryId\":2455976,\"price\":15,\"productPrice\":15,\"sku\":\"30701\",\"quantity\":1,\"shortDescription\":\"The项目你都被要求!妖兽酷船长的马克杯!咖啡固体14盎司或您喜爱的其他热点beve ......,税:0,发货:30.257246376811594,quantityInStock:104,名:队长的咖啡Mugs\",\"isShippingRequired\":true,\"weight\":3.5,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456142.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456146.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false,\"selectedOptions\":[{\"name\":\"Coffee杯,值:尺码,values​​Array:一Size\"],\"type\":\"CHOICE\"}]},{\"id\":69399851,\"productId\":46912544,\"categoryId\":2455976,\"price\":2,\"productPrice\":2,\"sku\":\"00421\",\"quantity\":1,\"shortDescription\":\"Gut金枪鱼标语。装饰你的汽车,卡车,渔船,储物柜,书桌,打印机或任何漂浮哟......,税:0,发货:0.8644927536231884,quantityInStock:59,名:标语 - 肠道Tuna\",\"isShippingRequired\":true,\"weight\":0.1,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972272.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972274.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false},{\"id\":69399852,\"productId\":46912548,\"categoryId\":2455976,\"price\":2,\"productPrice\":2,\"sku\":\"00423\",\"quantity\":1,\"shortDescription\":\"Wicked硬商品标语。装饰你的汽车,卡车,渔船,储物柜,书桌,打印机或世界卫生大会...,税:0,发货:0.8644927536231884quantityInStock:44,名:标语 - 妖兽硬Merchandise\",\"isShippingRequired\":true,\"weight\":0.1,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097549.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097553.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false}],\"billingPerson\":{\"name\":\"Anna Schütt,的companyName:,街头:Brunskogsbacken 94 \\ N3 tr\",\"city\":\"Farsta\",\"country$c$c\":\"SE\",\"countryName\":\"Sweden\",\"postal$c$c\":\"12371\",\"stateOrProvince$c$c\":\"AB\",\"stateOrProvinceName\":\"Stockholm\",\"phone\":\"0046707340555\"},\"shippingPerson\":{\"name\":\"Anna Schütt,的companyName:,街头:Brunskogsbacken 94 \\ N3 tr\",\"city\":\"Farsta\",\"country$c$c\":\"SE\",\"countryName\":\"Sweden\",\"postal$c$c\":\"12371\",\"stateOrProvince$c$c\":\"AB\",\"stateOrProvinceName\":\"Stockholm\",\"phone\":\"0046707340555\"},\"shippingOption\":{\"shippingCarrierName\":\"U.S.P.S.\",\"shippingMethodName\":\"U.S.P.S.优先邮件International®\",\"shippingRate\":59.65,\"estimatedTransitTime\":\"6-10\"},\"handlingFee\":{\"name\":\"Handling Fee\",\"value\":0,\"description\":\"\"},\"additionalInfo\":{},\"paymentParams\":{},\"hidden\":false},{\"vendorOrderNumber\":\"0137061\",\"subtotal\":38.95,\"total\":45.3,\"email\":\"Donnar544@comcast.net\",\"externalTransactionId\":\"5GS82233RB608634T\",\"paymentModule\":\"PayPalStandard\",\"paymentMethod\":\"PayPal /信用Card\",\"tax\":0,\"ipAddress\":\"73.130.161.92\",\"couponDiscount\":0,\"paymentStatus\":\"PAID\",\"paymentMessage\":\"Your订单已approved\",\"fulfillmentStatus\":\"AWAITING_PROCESSING\",\"orderNumber\":7061,\"refererUrl\":\"http://fvhardmerchandise.com/shop.html\",\"volumeDiscount\":0,\"customerId\":24198242,\"membershipBasedDiscount\":0,\"totalAndMembershipBasedDiscount\":0,\"discount\":0,\"usdTotal\":45.3,\"globalReferer\":\"http://www.bing.com/search?q=wicked+tuna+hard+merchandise&qs=RI&pq=wicked+tuna+merchandise&sk=AS1&sc=5-23&sp=2&cvid=7A53D47A788E49C39B6DC837AE8D3E82&FORM=QBLH&ghc=1\",\"createDate\":\"2016-01-08 1点10分十八秒+0000,updateDate:2016年1月8日1点12分07秒+0000\",\"createTimestamp\":1452215418,\"updateTimestamp\":1452215527,\"items\":[{\"id\":69376148,\"productId\":35290579,\"categoryId\":2455976,\"price\":14.95,\"productPrice\":14.95,\"sku\":\"00275\",\"quantity\":1,\"shortDescription\":\"Its终于来了 - 一个项目很多,你一直在等待!该上尉亚诺摇头于生活的色彩,以保持哟......:税:0,发货:3.0078947368421054,quantityInStock:195,名:上尉。马西亚诺Bobblehead\",\"isShippingRequired\":true,\"weight\":0.9,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187919.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187923.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false},{\"id\":69376149,\"productId\":35271535,\"categoryId\":2455976,\"price\":24,\"productPrice\":24,\"sku\":\"00351\",\"quantity\":1,\"shortDescription\":\"This从硬商品略微重新设计的衬衫现在已经在他们真棒WHI背面的CUDA品牌标识刀......,税:0,发货:3.3421052631578942,quantityInStock:71,名:高科技面料硬商品之友Shirt\",\"isShippingRequired\":true,\"weight\":1,\"trackQuantity\":true,\"fixedShippingRateOnly\":false,\"imageUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266743.jpg\",\"smallThumbnailUrl\":\"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266748.jpg\",\"fixedShippingRate\":0,\"digital\":false,\"productAvailable\":true,\"couponApplied\":false,\"selectedOptions\":[{\"name\":\"Size\",\"value\":\"X-Large\",\"valuesArray\":[\"X-Large\"],\"type\":\"CHOICE\"}]}],\"billingPerson\":{\"name\":\"Dale E查阅SR,的companyName:,街头:544棕榈城公园,城市:Annville,全国code:美国,国家名称:美国States\",\"postal$c$c\":\"17003\",\"stateOrProvince$c$c\":\"PA\",\"stateOrProvinceName\":\"Pennsylvania\",\"phone\":\"7176754357\"},\"shippingPerson\":{\"name\":\"Dale E查阅SR,的companyName:,街头:544棕榈城公园,城市:Annville,全国code:美国,国家名称:美国States\",\"postal$c$c\":\"17003\",\"stateOrProvince$c$c\":\"PA\",\"stateOrProvinceName\":\"Pennsylvania\",\"phone\":\"7176754357\"},\"shippingOption\":{\"shippingCarrierName\":\"U.S.P.S.\",\"shippingMethodName\":\"U.S.P.S.优先邮件2大雅¢,shippingRate:6.35,estimatedTransitTime:1-3},handlingFee:{名:手续费,值:0,说明: },additionalInfo:{},paymentParams:{},隐藏:假}]}布尔(真)

正如你所看到比原来的HTTPS输出上面的输出有大量的间距。此外,在年底看到布尔(真)。

PHP卷曲使用:

 &LT; PHP$ URL ='URL';//启动卷曲
$ CH = curl_init();
//启用SSL验证
curl_setopt($ CH,CURLOPT_SSL_VERIFYPEER,真正的);
//将返回应答,否则为false打印响应
curl_setopt($ CH,CURLOPT_RETURNTRANSFER,真正的);
//设置网址
curl_setopt($ CH,CURLOPT_URL,$网址);
// 执行
$结果= curl_exec($ CH);
//关闭
curl_close($ CH);//将转储美容JSON:3
//后续代码var_dump(json_de code($结果,真实));后续代码var_dump($结果,真正的);?&GT;


解决方案

我可以通过只使用一个直GET请求来解决这个问题。

 #HTTP GET请求例子$ URL = 'https://app.ecwid.com/api/v3/{STOREID}/orders?paymentStatus=PAID&fulfillmentStatus=AWAITING_PROCESSING&token={TOKEN}';$ CH = curl_init($网址);
curl_setopt($ CH,CURLOPT_TIMEOUT,5);
curl_setopt($ CH,CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($ CH,CURLOPT_RETURNTRANSFER,真正的);
$数据= curl_exec($ CH);
curl_close($ CH);回声$的数据;

I am working with an eCommerce shop on Ecwid. http://developers.ecwid.com/api-documentation#orders

Using the below curl to first show the data, but the data is coming out differently than the original supplied.

json using just the https address in the browser:

{"total":2,"count":2,"offset":0,"limit":100,"items":[{"vendorOrderNumber":"0137062","subtotal":79,"total":138.65,"email":"annaschutt@hotmail.com","externalTransactionId":"96U34224JE632150D","paymentModule":"PayPalStandard","paymentMethod":"PayPal / Credit Card","tax":0,"ipAddress":"80.217.64.221","couponDiscount":0,"paymentStatus":"PAID","paymentMessage":"Your order has been approved","fulfillmentStatus":"AWAITING_PROCESSING","orderNumber":7062,"refererUrl":"fbtab:https://www.facebook.com/fvhardmerchandise/?sk=app_251458316228","orderComments":"If its possible to get an autograph from the captain and the crew to my husband Amadeus it would be great. He just loves the show on tv and is also a fisherman here in Sweden.<br><br>Thank you<br>Anna","volumeDiscount":0,"customerId":24198510,"membershipBasedDiscount":0,"totalAndMembershipBasedDiscount":0,"discount":0,"usdTotal":138.65,"globalReferer":"https://staticxx.facebook.com/platform/page_proxy/r/hv09mZVdEP8.js","createDate":"2016-01-08 14:00:20 +0000","updateDate":"2016-01-08 14:04:15 +0000","createTimestamp":1452261620,"updateTimestamp":1452261855,"items":[{"id":69399848,"productId":51555117,"categoryId":2455976,"price":40,"productPrice":40,"sku":"00604","quantity":1,"shortDescription":"Royal Blue Long sleeve Tech shirt! At long last, a long sleeve tech shirt from Champion! This 100% jersey shirt is ligh...","tax":0,"shipping":17.28985507246377,"quantityInStock":23,"name":"Long Sleeve Hard Merchandise Tech Shirts","isShippingRequired":true,"weight":2,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499571.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499574.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false,"selectedOptions":[{"name":"Size","value":"X-Large","valuesArray":["X-Large"],"type":"CHOICE"}]},{"id":69399849,"productId":15479536,"categoryId":2455976,"price":20,"productPrice":20,"sku":"00096","quantity":1,"shortDescription":"Hard Merchandise hats are here! Fan favorite Hard Merch logo is featured in white on a classic black hat with our two t...","tax":0,"shipping":10.373913043478261,"quantityInStock":211,"name":"Baseball Hat","isShippingRequired":true,"weight":1.2,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111412.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111415.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false},{"id":69399850,"productId":37228667,"categoryId":2455976,"price":15,"productPrice":15,"sku":"30701","quantity":1,"shortDescription":"The item you have all been asking for! Wicked Cool Captain's Mug! Solid 14 oz of coffee or your other favorite hot beve...","tax":0,"shipping":30.257246376811594,"quantityInStock":104,"name":"Captain's Coffee Mugs","isShippingRequired":true,"weight":3.5,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456142.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456146.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false,"selectedOptions":[{"name":"Coffee Mug","value":"One Size","valuesArray":["One Size"],"type":"CHOICE"}]},{"id":69399851,"productId":46912544,"categoryId":2455976,"price":2,"productPrice":2,"sku":"00421","quantity":1,"shortDescription":"Gut Tuna Bumper Sticker. Decorate your car, truck, fishing vessel, storage locker, desk, printer, or whatever floats yo...","tax":0,"shipping":0.8644927536231884,"quantityInStock":59,"name":"Bumper Sticker - Gut Tuna","isShippingRequired":true,"weight":0.1,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972272.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972274.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false},{"id":69399852,"productId":46912548,"categoryId":2455976,"price":2,"productPrice":2,"sku":"00423","quantity":1,"shortDescription":"Wicked Hard Merchandise Bumper Sticker. Decorate your car, truck, fishing vessel, storage locker, desk, printer, or wha...","tax":0,"shipping":0.8644927536231884,"quantityInStock":44,"name":"Bumper Sticker - Wicked Hard Merchandise","isShippingRequired":true,"weight":0.1,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097549.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097553.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false}],"billingPerson":{"name":"Anna Schütt","companyName":"","street":"Brunskogsbacken 94\n3 tr","city":"Farsta","countryCode":"SE","countryName":"Sweden","postalCode":"12371","stateOrProvinceCode":"AB","stateOrProvinceName":"Stockholm","phone":"0046707340555"},"shippingPerson":{"name":"Anna Schütt","companyName":"","street":"Brunskogsbacken 94\n3 tr","city":"Farsta","countryCode":"SE","countryName":"Sweden","postalCode":"12371","stateOrProvinceCode":"AB","stateOrProvinceName":"Stockholm","phone":"0046707340555"},"shippingOption":{"shippingCarrierName":"U.S.P.S.","shippingMethodName":"U.S.P.S. Priority Mail International®","shippingRate":59.65,"estimatedTransitTime":"6-10"},"handlingFee":{"name":"Handling Fee","value":0,"description":""},"additionalInfo":{},"paymentParams":{},"hidden":false},{"vendorOrderNumber":"0137061","subtotal":38.95,"total":45.3,"email":"Donnar544@comcast.net","externalTransactionId":"5GS82233RB608634T","paymentModule":"PayPalStandard","paymentMethod":"PayPal / Credit Card","tax":0,"ipAddress":"73.130.161.92","couponDiscount":0,"paymentStatus":"PAID","paymentMessage":"Your order has been approved","fulfillmentStatus":"AWAITING_PROCESSING","orderNumber":7061,"refererUrl":"http://fvhardmerchandise.com/shop.html","volumeDiscount":0,"customerId":24198242,"membershipBasedDiscount":0,"totalAndMembershipBasedDiscount":0,"discount":0,"usdTotal":45.3,"globalReferer":"http://www.bing.com/search?q=wicked+tuna+hard+merchandise&qs=RI&pq=wicked+tuna+merchandise&sk=AS1&sc=5-23&sp=2&cvid=7A53D47A788E49C39B6DC837AE8D3E82&FORM=QBLH&ghc=1","createDate":"2016-01-08 01:10:18 +0000","updateDate":"2016-01-08 01:12:07 +0000","createTimestamp":1452215418,"updateTimestamp":1452215527,"items":[{"id":69376148,"productId":35290579,"categoryId":2455976,"price":14.95,"productPrice":14.95,"sku":"00275","quantity":1,"shortDescription":"Its finally here - an item lots of you have been waiting for! The Capt. Marciano Bobblehead in living color to keep yo...","tax":0,"shipping":3.0078947368421054,"quantityInStock":195,"name":"Capt. Marciano Bobblehead","isShippingRequired":true,"weight":0.9,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187919.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187923.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false},{"id":69376149,"productId":35271535,"categoryId":2455976,"price":24,"productPrice":24,"sku":"00351","quantity":1,"shortDescription":"This slightly redesigned shirt from Hard Merchandise now has the CUDA brand knife logo on the back in their awesome whi...","tax":0,"shipping":3.3421052631578942,"quantityInStock":71,"name":"Tech Fabric Friends of Hard Merchandise Shirt","isShippingRequired":true,"weight":1,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266743.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266748.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false,"selectedOptions":[{"name":"Size","value":"X-Large","valuesArray":["X-Large"],"type":"CHOICE"}]}],"billingPerson":{"name":"Dale E Read Sr","companyName":"","street":"544 Palm City Park","city":"Annville","countryCode":"US","countryName":"United States","postalCode":"17003","stateOrProvinceCode":"PA","stateOrProvinceName":"Pennsylvania","phone":"7176754357"},"shippingPerson":{"name":"Dale E Read Sr","companyName":"","street":"544 Palm City Park","city":"Annville","countryCode":"US","countryName":"United States","postalCode":"17003","stateOrProvinceCode":"PA","stateOrProvinceName":"Pennsylvania","phone":"7176754357"},"shippingOption":{"shippingCarrierName":"U.S.P.S.","shippingMethodName":"U.S.P.S. Priority Mail 2-Day™","shippingRate":6.35,"estimatedTransitTime":"1-3"},"handlingFee":{"name":"Handling Fee","value":0,"description":""},"additionalInfo":{},"paymentParams":{},"hidden":false}]}

json shown in the browser via php using curl:

    string(8820) "{"total":2,"count":2,"offset":0,"limit":100,"items":[{"vendorOrderNumber":"0137062","subtotal":79,"total":138.65,"email":"annaschutt@hotmail.com","externalTransactionId":"96U34224JE632150D","paymentModule":"PayPalStandard","paymentMethod":"PayPal / Credit Card","tax":0,"ipAddress":"80.217.64.221","couponDiscount":0,"paymentStatus":"PAID","paymentMessage":"Your order has been approved","fulfillmentStatus":"AWAITING_PROCESSING","orderNumber":7062,"refererUrl":"fbtab:https://www.facebook.com/fvhardmerchandise/?sk=app_251458316228","orderComments":"If its possible to get an autograph from the captain and the crew to my husband Amadeus it would be great. He just loves the show on tv and is also a fisherman here in Sweden.

Thank you
Anna","volumeDiscount":0,"customerId":24198510,"membershipBasedDiscount":0,"totalAndMembershipBasedDiscount":0,"discount":0,"usdTotal":138.65,"globalReferer":"https://staticxx.facebook.com/platform/page_proxy/r/hv09mZVdEP8.js","createDate":"2016-01-08 14:00:20 +0000","updateDate":"2016-01-08 14:04:15 +0000","createTimestamp":1452261620,"updateTimestamp":1452261855,"items":[{"id":69399848,"productId":51555117,"categoryId":2455976,"price":40,"productPrice":40,"sku":"00604","quantity":1,"shortDescription":"Royal Blue Long sleeve Tech shirt! At long last, a long sleeve tech shirt from Champion! This 100% jersey shirt is ligh...","tax":0,"shipping":17.28985507246377,"quantityInStock":23,"name":"Long Sleeve Hard Merchandise Tech Shirts","isShippingRequired":true,"weight":2,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499571.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/291499574.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false,"selectedOptions":[{"name":"Size","value":"X-Large","valuesArray":["X-Large"],"type":"CHOICE"}]},{"id":69399849,"productId":15479536,"categoryId":2455976,"price":20,"productPrice":20,"sku":"00096","quantity":1,"shortDescription":"Hard Merchandise hats are here! Fan favorite Hard Merch logo is featured in white on a classic black hat with our two t...","tax":0,"shipping":10.373913043478261,"quantityInStock":211,"name":"Baseball Hat","isShippingRequired":true,"weight":1.2,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111412.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/51111415.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false},{"id":69399850,"productId":37228667,"categoryId":2455976,"price":15,"productPrice":15,"sku":"30701","quantity":1,"shortDescription":"The item you have all been asking for! Wicked Cool Captain's Mug! Solid 14 oz of coffee or your other favorite hot beve...","tax":0,"shipping":30.257246376811594,"quantityInStock":104,"name":"Captain's Coffee Mugs","isShippingRequired":true,"weight":3.5,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456142.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/231456146.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false,"selectedOptions":[{"name":"Coffee Mug","value":"One Size","valuesArray":["One Size"],"type":"CHOICE"}]},{"id":69399851,"productId":46912544,"categoryId":2455976,"price":2,"productPrice":2,"sku":"00421","quantity":1,"shortDescription":"Gut Tuna Bumper Sticker. Decorate your car, truck, fishing vessel, storage locker, desk, printer, or whatever floats yo...","tax":0,"shipping":0.8644927536231884,"quantityInStock":59,"name":"Bumper Sticker - Gut Tuna","isShippingRequired":true,"weight":0.1,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972272.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/264972274.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false},{"id":69399852,"productId":46912548,"categoryId":2455976,"price":2,"productPrice":2,"sku":"00423","quantity":1,"shortDescription":"Wicked Hard Merchandise Bumper Sticker. Decorate your car, truck, fishing vessel, storage locker, desk, printer, or wha...","tax":0,"shipping":0.8644927536231884,"quantityInStock":44,"name":"Bumper Sticker - Wicked Hard Merchandise","isShippingRequired":true,"weight":0.1,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097549.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/265097553.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false}],"billingPerson":{"name":"Anna Schütt","companyName":"","street":"Brunskogsbacken 94\n3 tr","city":"Farsta","countryCode":"SE","countryName":"Sweden","postalCode":"12371","stateOrProvinceCode":"AB","stateOrProvinceName":"Stockholm","phone":"0046707340555"},"shippingPerson":{"name":"Anna Schütt","companyName":"","street":"Brunskogsbacken 94\n3 tr","city":"Farsta","countryCode":"SE","countryName":"Sweden","postalCode":"12371","stateOrProvinceCode":"AB","stateOrProvinceName":"Stockholm","phone":"0046707340555"},"shippingOption":{"shippingCarrierName":"U.S.P.S.","shippingMethodName":"U.S.P.S. Priority Mail International®","shippingRate":59.65,"estimatedTransitTime":"6-10"},"handlingFee":{"name":"Handling Fee","value":0,"description":""},"additionalInfo":{},"paymentParams":{},"hidden":false},{"vendorOrderNumber":"0137061","subtotal":38.95,"total":45.3,"email":"Donnar544@comcast.net","externalTransactionId":"5GS82233RB608634T","paymentModule":"PayPalStandard","paymentMethod":"PayPal / Credit Card","tax":0,"ipAddress":"73.130.161.92","couponDiscount":0,"paymentStatus":"PAID","paymentMessage":"Your order has been approved","fulfillmentStatus":"AWAITING_PROCESSING","orderNumber":7061,"refererUrl":"http://fvhardmerchandise.com/shop.html","volumeDiscount":0,"customerId":24198242,"membershipBasedDiscount":0,"totalAndMembershipBasedDiscount":0,"discount":0,"usdTotal":45.3,"globalReferer":"http://www.bing.com/search?q=wicked+tuna+hard+merchandise&qs=RI&pq=wicked+tuna+merchandise&sk=AS1&sc=5-23&sp=2&cvid=7A53D47A788E49C39B6DC837AE8D3E82&FORM=QBLH&ghc=1","createDate":"2016-01-08 01:10:18 +0000","updateDate":"2016-01-08 01:12:07 +0000","createTimestamp":1452215418,"updateTimestamp":1452215527,"items":[{"id":69376148,"productId":35290579,"categoryId":2455976,"price":14.95,"productPrice":14.95,"sku":"00275","quantity":1,"shortDescription":"Its finally here - an item lots of you have been waiting for! The Capt. Marciano Bobblehead in living color to keep yo...","tax":0,"shipping":3.0078947368421054,"quantityInStock":195,"name":"Capt. Marciano Bobblehead","isShippingRequired":true,"weight":0.9,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187919.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/222187923.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false},{"id":69376149,"productId":35271535,"categoryId":2455976,"price":24,"productPrice":24,"sku":"00351","quantity":1,"shortDescription":"This slightly redesigned shirt from Hard Merchandise now has the CUDA brand knife logo on the back in their awesome whi...","tax":0,"shipping":3.3421052631578942,"quantityInStock":71,"name":"Tech Fabric Friends of Hard Merchandise Shirt","isShippingRequired":true,"weight":1,"trackQuantity":true,"fixedShippingRateOnly":false,"imageUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266743.jpg","smallThumbnailUrl":"https://dpbfm6h358sh7.cloudfront.net/images/1039296/313266748.jpg","fixedShippingRate":0,"digital":false,"productAvailable":true,"couponApplied":false,"selectedOptions":[{"name":"Size","value":"X-Large","valuesArray":["X-Large"],"type":"CHOICE"}]}],"billingPerson":{"name":"Dale E Read Sr","companyName":"","street":"544 Palm City Park","city":"Annville","countryCode":"US","countryName":"United States","postalCode":"17003","stateOrProvinceCode":"PA","stateOrProvinceName":"Pennsylvania","phone":"7176754357"},"shippingPerson":{"name":"Dale E Read Sr","companyName":"","street":"544 Palm City Park","city":"Annville","countryCode":"US","countryName":"United States","postalCode":"17003","stateOrProvinceCode":"PA","stateOrProvinceName":"Pennsylvania","phone":"7176754357"},"shippingOption":{"shippingCarrierName":"U.S.P.S.","shippingMethodName":"U.S.P.S. Priority Mail 2-Day™","shippingRate":6.35,"estimatedTransitTime":"1-3"},"handlingFee":{"name":"Handling Fee","value":0,"description":""},"additionalInfo":{},"paymentParams":{},"hidden":false}]}" bool(true)

As you can see the above output has large amounts of spacing compared to the original HTTPS output. Also seeing bool(true)at the end.

PHP Curl used:

    <?php

$url = 'URL';

//  Initiate curl
$ch = curl_init();
// Enable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);

// Will dump a beauty json :3
//var_dump(json_decode($result, true));

var_dump($result, true);

?>

解决方案

I was able to fix this issue by just using a straight GET request.

# An HTTP GET request example

$url = 'https://app.ecwid.com/api/v3/{STOREID}/orders?paymentStatus=PAID&fulfillmentStatus=AWAITING_PROCESSING&token={TOKEN}';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);

echo $data;

这篇关于Ecwid订单 - JSON输出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆