Advertisement
Spidow5

Untitled

Mar 17th, 2025
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. $api_url = "/api/order-status";
  4. $order_id = "779";
  5. $response = file_get_contents("$api_url?order_id=$order_id");
  6. $order_data = json_decode($response, true);
  7.  
  8. if ($order_data && isset($order_data['status'])) {
  9.     if ($order_data['status'] === "Paid") {
  10.         $encoded_url = "aHR0cHM6Ly9kcml2ZS5nb29nbGUuY29tL2ZpbGUvZC8xOEFkU0N2NnNxbFpJbUxfS3FxdmhMWTJoaHFEZ2tNMTcvdmlldz91c3A9bWV0aG9kLnBkZg==";
  11.         $encoded_warning = "UmVtZW1iZXIgdG8gbm90IHVzZSBpdCBmb3Igb3JkZXJzIGFib3ZlICQyMDAwIGF0IG9uY2UgLSB0aGV5IHdpbGwgYmxvY2sgeW91IGFuZCB5b3VyIG5ldHdvcmsu";
  12.         $message = "Thank you for your purchase!" . $encoded_url . "\n" . $encoded_warning;
  13.         sendMessage($order_data['user_email'], $message);
  14.     } else {
  15.         echo "Unpaid";
  16.     }
  17. } else {
  18.     echo "Invalid response from store API.";
  19. }
  20.  
  21. function sendMessage($recipient, $message) {
  22.     echo "Message sent to $recipient: \n$message";
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement