Advertisement
Max13

Send_PushMe

Oct 10th, 2011
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. <?php
  2. function send_push($message, $die = false)
  3. {
  4.     // Cookie
  5.     $cookieFile = 'Cookies/PushMeCookie.ck';
  6.  
  7.     //set POST variables
  8.     $url = 'http://pushme.to/max13/';
  9.     $var_post = "_encoding=UTF-8&signature=Epitech@Rihan.fr&message=$message";
  10.  
  11.     //open connection
  12.     $ch = curl_init();
  13.  
  14.     //set the url, number of POST vars, POST data
  15.     curl_setopt($ch, CURLOPT_URL, $url);
  16.     curl_setopt($ch, CURLOPT_POST, 1);
  17.     curl_setopt($ch, CURLOPT_POSTFIELDS, $var_post);
  18.  
  19.     // Checking/Setting Cookie
  20.     if (file_exists($cookieFile))
  21.         curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile);
  22.     else
  23.         curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
  24.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  25.  
  26.     //execute post
  27.     $result = curl_exec($ch);
  28.  
  29.     //close connection
  30.     curl_close($ch);
  31.  
  32.     if ( $die == true )
  33.         die();
  34. }
  35. ?>
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement