Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- mysqli_report(MYSQLI_REPORT_ALL & ~MYSQLI_REPORT_INDEX);
- $url = "https://staging.logistics.com/v2/shipments/create";
- $data = array
- (
- "request_id"=> "R09",
- "client_name"=> "DOC",
- "services"=> [
- array (
- "service_code"=> "REGULAR",
- "service_details"=> [
- array (
- "service_leg"=> "FORWARD",
- "service_data"=> array (
- "vendor_name"=>"dailyorders",
- "amount_to_collect"=> 1000,
- "dispatch_date"=> "",
- "customer_promise_date"=> "",
- "delivery_type"=> "SMALL",
- "source"=> array (
- "address"=> array (
- "first_name"=> "AVThamizhmahan",
- "address_line1"=> "31675 ES Garden Vazhudaretty Post Villupuram",
- "address_line2"=> "Tamil Nadu",
- "pincode"=> "400066",
- "city"=> "Villupuram",
- "state"=> "Tamil Nadu",
- "primary_contact_number"=> "88888888"
- )
- ),
- "destination"=> array (
- "address"=> array (
- "first_name"=> "AVThamizhmahan",
- "address_line1"=> "31675 ES Garden Vazhudaretty Post Villupuram",
- "address_line2"=> "Tamil Nadu",
- "pincode"=> "400066",
- "city"=> "Villupuram",
- "state"=> "Tamil Nadu",
- "primary_contact_number"=> "88888888"
- )
- ),
- "return_location"=> array (
- "address"=> array (
- "first_name"=> "AVThamizhmahan",
- "address_line1"=> "31675 ES Garden Vazhudaretty Post Villupuram",
- "address_line2"=> "Tamil Nadu",
- "pincode"=> "400066",
- "city"=> "Villupuram",
- "state"=> "Tamil Nadu",
- "primary_contact_number"=> "88888888"
- )
- )
- ),
- "shipment"=> array (
- "client_reference_id"=> "ABCD",
- "tracking_id"=> "DOCC0000000001",
- "shipment_value"=> 2000,
- "shipment_dimensions"=> array (
- "length"=> array (
- "value"=> 1
- ),
- "breadth"=> array (
- "value"=> 1
- ),
- "height"=> array (
- "value"=> 1
- ),
- "weight"=> array (
- "value"=> 1
- )
- ),
- "return_label_desc_1"=> "",
- "return_label_desc_2"=> "",
- "shipment_items"=> [
- array (
- "product_id"=> "134883075",
- "item_content"=>array (),
- "category"=> "Apparel",
- "product_title"=> "Mast&HarbourBlackHandbag=> Handbags",
- "quantity"=> 1,
- "cost"=> array (
- "total_sale_value"=> 500,
- "total_tax_value"=> 100 ,
- "tax_breakup"=>array (
- "cgst"=>0.0,
- "sgst"=>0.0,
- "igst"=>0.0
- )
- ),
- "seller_details"=> array (
- "seller_reg_name"=> "Seller Registered Legal Name",
- "vat_id"=> "",
- "cst_id"=> "",
- "tin_id"=>"",
- "gstin_id"=>""
- ),
- "hsn" =>"",
- "ern"=>"",
- "discount"=>0.0,
- "legal_entity"=> "",
- "billable_entity"=> "",
- "cod_remittance_entity"=> "",
- "item_attributes"=> [
- array (
- "name"=> "order_id",
- "value"=> "ABCD"
- ),
- array (
- "name"=> "invoice_id",
- "value"=> "INV1234"
- ),
- array (
- "name"=> "item_dimensions",
- "value"=> "l=>b=>h=>w"
- ),
- array (
- "name"=> "brand_name",
- "value"=> "Peter England"
- )
- ],
- "handling_attributes"=> [
- array (
- "name"=> "isFragile",
- "value"=> "false"
- ),
- array (
- "name"=> "isDangerous",
- "value"=> "false"
- )
- ]
- )
- ]
- )
- )
- ]
- )
- ]
- );
- echo $data=json_encode($data);
- /*
- $data_string = json_encode(array(
- "Payload" => $data
- ));
- */
- $ch = curl_init($url);
- //curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
- //curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- "Content-Type : application/json"
- ));
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- "Authorization : Basic ZGFpbHlvcmRlcnM6ZHVtbXlLZXk="
- ));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- $result = curl_exec($ch);
- curl_close($ch);
- echo "$result";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement