Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770
Форумы портала PHP.SU :: Версия для печати :: откуда крякозябры
Форумы портала PHP.SU » » Работа с сетью » откуда крякозябры

Страниц (1): [1]
 

1. alexiy - 16 Декабря, 2012 - 21:52:35 - перейти к сообщению
вывожу на сайт новое письмо со своей почты (gmail)
PHP:
скопировать код в буфер обмена
  1.  
  2. <?PHP
  3. header('Content-Type: text/html; charset=utf-8');
  4. $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
  5. $username = 'sdsd@gmail.com';
  6. $password = 'sdsds';
  7.  
  8. $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
  9. $emails = imap_search($inbox,'UNSEEN');//UNSEEN
  10.  
  11. if($emails){ // Check if there are any emails
  12.  
  13. rsort($emails); /* Sorts the email such that the new emails comes first*/
  14.  
  15.  
  16.  
  17. /*  Get the email one by one using ID */
  18. foreach($emails as $email_number) {
  19. // Get the email [headers]  like FROM, TO, SUBJECT, DATE, SERVER etc
  20. $overview = imap_fetch_overview($inbox,$email_number,0);
  21.         echo "<b>From:</b> ".$overview[0]->from."<br>";
  22.         echo "<b>Date:</b> ".$overview[0]->date."<br>";
  23.         echo $overview[0]->subject."<br>";
  24.  
  25. // Get the Email Body
  26. $message = imap_fetchbody($inbox,$email_number,1)."<hr><br>";
  27.  
  28.  
  29. echo $message;  // Prints the message in Text format.
  30. }
  31.  
  32. }
  33.  
  34. /* close the connection */
  35. imap_close($inbox);
  36.  
  37. ?>
  38.  


в результате выводит сообщение YXNkcyDQz8zV3snMPwo= а должен был вывести "Получил?"
так же крякозябры вылетают когда отображается, от кого пришло сообщение
=?KOI8-R?B?4czFy9PFyiDiz8rDz9c=?= а должно было вывести aboicov@gmail.com
в чем проблема?
2. LIME - 16 Декабря, 2012 - 22:06:10 - перейти к сообщению
base_64_decode()
3. alexiy - 16 Декабря, 2012 - 22:21:41 - перейти к сообщению
LIME че-то не помогает

 

Powered by ExBB FM 1.0 RC1