Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]wysłanie sms-a przez bramkę
platynamen
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 29.03.2011

Ostrzeżenie: (0%)
-----


napisałem taki kod:
  1. function curl ($url, $post = NULL, $ref = NULL, $follow = 1, $header = 1, $post_type = NULL)
  2. {
  3. $ch = curl_init ($url);
  4. curl_setopt($ch, CURLOPT_ENCODING , '');
  5. curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7');
  6. curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
  7.  
  8. // Zapisywanie ciastek do pliku
  9. curl_setopt($ch,CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
  10. curl_setopt($ch,CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
  11.  
  12. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  13. if ( $ref )
  14. {
  15. curl_setopt($ch, CURLOPT_REFERER, $ref);
  16. }
  17. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  18.  
  19.  
  20. if ( ! empty($post) )
  21. {
  22. $postVars='';
  23.  
  24. foreach ($post as $option => $value)
  25. {
  26. $postVars .= $option.'='.urlencode($value).'&';
  27. }
  28. $postVars = substr($postVars, 0, strlen($postVars)-1);
  29. curl_setopt($ch, CURLOPT_POST, 1);
  30. curl_setopt($ch, CURLOPT_POSTFIELDS, $postVars);
  31.  
  32. }
  33.  
  34.  
  35.  
  36. curl_setopt($ch,CURLOPT_HEADER, 1);
  37. $header = array();
  38.  
  39. $header[] = 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
  40.  
  41. $header[] = 'Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7';
  42.  
  43. $header[] = 'Accept-Language: pl,en-us;q=0.7,en;q=0.3';
  44.  
  45. $header[] = 'Connection: keep-alive';
  46.  
  47. $header[] = 'Host: <a href="http://sms.priv.pl/';" target="_blank">http://sms.priv.pl/';</a>
  48.  
  49. $header[] = 'Keep-Alive: 300';
  50. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  51. curl_setopt($ch,CURLOPT_FOLLOWLOCATION, $follow);
  52. $r = curl_exec($ch);
  53. curl_close($ch);
  54.  
  55. return $r;
  56. }
  57.  
  58. function send_sms($kier,$nr, $msg, $od)
  59. {
  60.  
  61. $data=array('status' => 'send','siec' => $kier, 'number2' => $nr, 'tresc' => $msg, 'od' => $od, 'zostalo' => (string)(412-strlen($msg)), 'nr' => '', 'mms' => 'off');
  62.  
  63.  
  64.  
  65. $co=curl("http://sms.priv.pl/",$data,"http://sms.priv.pl/");
  66. echo $co;
  67.  
  68.  
  69. }

Niestety sms-y nie są wysyłane.
Go to the top of the page
+Quote Post
webdice
post
Post #2


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Nie mam ochoty na analizowanie tego kodu, ale zainteresuj się usługami jakie oferuje smsapi.pl lub inne tego typu portale.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 17:53