Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $api_url = "/api/order-status";
- $order_id = "523";
- $response = file_get_contents("$api_url?order_id=$order_id");
- $order_data = json_decode($response, true);
- if ($order_data && isset($order_data['status'])) {
- if ($order_data['status'] === "Paid") {
- $encoded_url = "aHR0cHM6Ly9kcml2ZS5nb29nbGUuY29tL2ZpbGUvZC8xOEFkU0N2NnNxbFpJbUxfS3FxdmhMWTJoaHFEZ2tNMTcvdmlldz91c3A9bWV0aG9kLnBkZg==";
- $encoded_warning = "UmVtZW1iZXIgdG8gbm90IHVzZSBpdCBmb3Igb3JkZXJzIGFib3ZlICQyMDAwIGF0IG9uY2UgLSB0aGV5IHdpbGwgYmxvY2sgeW91IGFuZCB5b3VyIG5ldHdvcmsu";
- $message = "Thank you for your purchase!" . $encoded_url . "\n" . $encoded_warning;
- sendMessage($order_data['user_email'], $message);
- } else {
- echo "Unpaid";
- }
- } else {
- echo "Invalid response from store API.";
- }
- function sendMessage($recipient, $message) {
- echo "Message sent to $recipient: \n$message";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement