Skip to content

Instantly share code, notes, and snippets.

@WesSouza
Created September 12, 2009 17:55
Show Gist options
  • Save WesSouza/185922 to your computer and use it in GitHub Desktop.
Save WesSouza/185922 to your computer and use it in GitHub Desktop.
<?php
$notif_post_data = array
(
"user_credentials" => "--CREDENTIALS-HERE--",
"notification[message]" => "Notification Dialog Message",
"notification[long_message]" => "<b>HTML Description</b>",
"notification[title]" => "Message Title",
"notification[long_message_preview]" => "Message Preview",
"notification[message_level]" => "0",
"notification[silent]" => "0",
"notification[action_loc_key]" => "Google",
"notification[run_command]" => "http://www.google.com/",
"notification[sound]" => "5.caf",
);
$notif_post_data_encoded = "";
foreach ( $notif_post_data as $k => $v )
$notif_post_data_encoded .= ( $notif_post_data_encoded ? "&" : "" ) . rawurlencode( $k ) ."=". rawurlencode( utf8_encode( $v ) );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "https://www.appnotifications.com/account/notifications.xml" );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $notif_post_data_encoded );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_exec( $ch );
curl_close( $ch );
unset( $notif_post_data, $notif_post_data_encoded );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment