Skip to content

Instantly share code, notes, and snippets.

@ahmedghazi
Last active June 30, 2017 13:03
Show Gist options
  • Save ahmedghazi/6745b7f6161200be14230e553c5456ce to your computer and use it in GitHub Desktop.
Save ahmedghazi/6745b7f6161200be14230e553c5456ce to your computer and use it in GitHub Desktop.
$body = array(
array(
'offerIdTarifs' => "FPP-CLASSIC",
'pickupName' => get_bloginfo("name"),
'pickupLatitude' => PICKUPLAT,
'pickupLongitude' => PICKUPLNG,
'pickupAddress' => PICKUPADRESSE,
'pickupAddress2' => "",
'pickupTel' => PICKUPTEL,
'pickupZip' => PICKUPZIP,
'pickupCity' => PICKUPCITY,
'recipientName' => $order->get_formatted_shipping_full_name(),
'recipientLatitude' => $recipientLatLng["lat"],
'recipientLongitude' => $recipientLatLng["lng"],
'recipientAddress' => $addresses["address_1"],
'recipientAddress2' => $addresses["address_2"],
'recipientTel' => $order->billing_phone,
'recipientZip' => $addresses["postcode"],
'recipientCity' => $addresses["city"],
//'timeManagement' => "2015-04-24 00:00:00",
'deliveryType' => "En main propre",
)
);
$body = json_encode( $body );
$url = COURIIER_WS.'/orders';
$args = array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(
'apikey' => COURIIER_API_KEY
),
'body' => array(
'datas' => $body
),
'cookies' => array()
);
$response = wp_remote_post( $url, $args);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment