Порядок Ecwid - выпуск JSON

1

Я работаю с магазином электронной коммерции в Ecwid. http://developers.ecwid.com/api-documentation#orders

Используя приведенный ниже скручивание, чтобы сначала показать данные, но данные выходят иначе, чем исходный.

json, используя только адрес https в браузере:

{"total":2,"count":2,"offset":0,"limit":100,"items":[{"vendorOrderNumber":"0137062","subtotal":79,"total":138.65,"email":"[email protected]","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 Mug! Solid 14 oz of coffee or your other favorite hot beve...","tax":0,"shipping":30.257246376811594,"quantityInStock":104,"name":"Captain 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":"[email protected]","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 отображается в браузере через php, используя curl:

    string(8820) "{"total":2,"count":2,"offset":0,"limit":100,"items":[{"vendorOrderNumber":"0137062","subtotal":79,"total":138.65,"email":"[email protected]","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 Mug! Solid 14 oz of coffee or your other favorite hot beve...","tax":0,"shipping":30.257246376811594,"quantityInStock":104,"name":"Captain 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":"[email protected]","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)

Как вы можете видеть, вышеупомянутый выход имеет большие промежутки времени по сравнению с исходным выходом HTTPS. Также смотрите bool (true) в конце.

PHP Curl используется:

    <?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);

?>
  • 0
    рассмотрите возможность редактирования своего Q, чтобы выделить разницу между двумя выходами. За исключением ведущей string(8820) " это не очевидно. Удачи.
Теги:
curl

1 ответ

0

Я смог исправить эту проблему, просто используя прямой запрос GET.

# 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;

Ещё вопросы

Сообщество Overcoder
Наверх
Меню