{
"status": "SUCCESS",
"orders": [
{
"order_id": 41757728,
"shop_order_id": "",
"external_order_id": "",
"order_source": "personal",
"order_source_id": "0",
"order_source_info": "-",
"order_status_id": 102703,
"confirmed": true,
"date_confirmed": 1655196321,
"date_add": 1655196285,
"date_in_status": 1655196321,
"user_login": "",
"phone": "+40771011404",
"email": "c.nelu123@gmail.com",
"user_comments": "",
"admin_comments": "",
"currency": "PLN",
"payment_method": "",
"payment_method_cod": "0",
"payment_done": 0,
"delivery_method": "",
"delivery_price": 0,
"delivery_package_module": "other",
"delivery_package_nr": "1ONB24118307496",
"delivery_fullname": "Nelu Constantin",
"delivery_company": "SC URBAN OUTFILTERS SRL",
"delivery_address": "Str. Pestera Dambovicioara, nr 2",
"delivery_city": "Sector 6, B",
"delivery_postcode": "060925",
"delivery_country_code": "RO",
"delivery_point_id": "",
"delivery_point_name": "",
"delivery_point_address": "",
"delivery_point_postcode": "",
"delivery_point_city": "",
"invoice_fullname": "Nelu Constantin",
"invoice_company": "SC URBAN OUTFILTERS SRL",
"invoice_nip": "38330774",
"invoice_address": "Str. Pestera Dambovicioara, nr 2",
"invoice_city": "Sector 6 B",
"invoice_postcode": "060925",
"invoice_country_code": "RO",
"want_invoice": "1",
"extra_field_1": "",
"extra_field_2": "",
"order_page": "https://orders-d.baselinker.com/41757728/vnw2avx0iq/",
"pick_state": 0,
"pack_state": 0,
"delivery_country": "Romania",
"invoice_country": "Romania",
"products": [
{
"storage": "db",
"storage_id": "2937",
"order_product_id": "72137130",
"product_id": "70902059",
"variant_id": "0",
"name": "Adaptor Priza Remorca, Volkswagen, de la 13 la 7 pini, Negru",
"attributes": "",
"sku": "000055400WF",
"ean": "5704327085942",
"location": "",
"warehouse_id": 3369,
"auction_id": "0",
"price_brutto": 122.84,
"tax_rate": 0,
"quantity": 1,
"weight": 2,
"bundle_id": 0
},
{
"storage": "db",
"storage_id": "2937",
"order_product_id": "72137131",
"product_id": "70900433",
"variant_id": "0",
"name": "Acumulator extern Skoda, 10,000 Ah",
"attributes": "",
"sku": "000051729D",
"ean": "8595577900973",
"location": "",
"warehouse_id": 3369,
"auction_id": "0",
"price_brutto": 188.99,
"tax_rate": 0,
"quantity": 1,
"weight": 2,
"bundle_id": 0
}
]
},
{
"order_id": 41802654,
"shop_order_id": "",
"external_order_id": "256937252",
"order_source": "emagro",
"order_source_id": "17626",
"order_source_info": "-",
"order_status_id": 102703,
"confirmed": true,
"date_confirmed": 1655210221,
"date_add": 1655213145,
"date_in_status": 1655210221,
"user_login": "",
"phone": "+40762158570",
"email": "n.constantin@baselinker.com",
"user_comments": "",
"admin_comments": "",
"currency": "RON",
"payment_method": "Online card payment",
"payment_method_cod": "0",
"payment_done": 203.44,
"delivery_method": "Parcel locker",
"delivery_price": 0,
"delivery_package_module": "",
"delivery_package_nr": "",
"delivery_fullname": "Banicioiu Mihai",
"delivery_company": "",
"delivery_address": "Str. Dezrobirii Nr. 176 [EasyBox #9492]",
"delivery_city": "Craiova, Dolj",
"delivery_postcode": "",
"delivery_country_code": "RO",
"delivery_point_id": "",
"delivery_point_name": "easybox Piata Dezrobirii",
"delivery_point_address": "Str. Dezrobirii Nr. 176 [EasyBox #9492]",
"delivery_point_postcode": "",
"delivery_point_city": "Craiova",
"invoice_fullname": "Banicioiu Mihai",
"invoice_company": "",
"invoice_nip": "",
"invoice_address": "Str Virgil Madgearu Nr 19 Et 1 Ap 1",
"invoice_city": "Craiova, Dolj",
"invoice_postcode": "",
"invoice_country_code": "RO",
"want_invoice": "0",
"extra_field_1": "",
"extra_field_2": "",
"order_page": "https://orders-d.baselinker.com/41802654/uyd26m54po/",
"pick_state": 0,
"pack_state": 0,
"delivery_country": "Romania",
"invoice_country": "Romania",
"products": [
{
"storage": "db",
"storage_id": "2937",
"order_product_id": "72219013",
"product_id": "",
"variant_id": "",
"name": "Macheta Auto Skoda Kamiq , 1:43, Rosu",
"attributes": "",
"sku": "658099300F3P",
"ean": "",
"location": "",
"warehouse_id": 0,
"auction_id": "DC8H4MMBM",
"price_brutto": 203.44,
"tax_rate": 0,
"quantity": 1,
"weight": 0,
"bundle_id": 0
}
]
}
]
}
My code
"getOrders",
"parameters" => $methodParams
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.baselinker.com/connector.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-BLToken: TOKEN"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($apiParams));
$output = curl_exec($ch);
$data = json_decode($output, true);
foreach($data['orders'] as $key => $val)
{
$orderidbl = $val['order_id'];
$phone = $val['phone'];
$name = $val['delivery_fullname'];
//open db
$dbc = mysqli_connect ('localhost', 'db', 'pass');
$dbSelected = mysqli_select_db($dbc , "db");
//insert values into db; the values are inserted, along with the time right now.
$query = "INSERT INTO Orders (OrderID,Name,Phone)".
"VALUES ('$orderidbl','$name','$phone')";
$result = mysqli_query ($dbc, $query) or die ('Error inserting into db.');
//we're done.
mysqli_close ($dbc);
}
?>
I want to take order_id and delivery_fullname for each order from this array. i tried all topics and i can't figure it out. I would much appreciate if anyone could help me.