Skip to content

Instantly share code, notes, and snippets.

@freyandhy
Created November 27, 2019 13:55
Show Gist options
  • Save freyandhy/ed12551dcd3fda1a18ac6b5c90102675 to your computer and use it in GitHub Desktop.
Save freyandhy/ed12551dcd3fda1a18ac6b5c90102675 to your computer and use it in GitHub Desktop.
Testing Get Name at WooCommerce Email
<?php
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$name = $order->get_formatted_billing_full_name();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://hooks.slack.com/services/ss/x/x');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"text\":\"@here Ada 1 Order Nih\"}");
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"text\":\"@here Halo, ada yang order nih dari si $name\"}");
$headers = array();
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment