У мене зараз є цей код.
<?php
$username = 'EMAIL ADDRESS';
$password = 'EMAIL ADDRESS';
$opts = array(
'http' => array(
'method' => 'GET',
'header' => sprintf("Authorization: Basic %s\r\nUser-Agent: Foobar!", base64_encode($username.':'.$password))
)
);
$context = stream_context_create($opts);
libxml_set_streams_context($context);
$xml = new SimpleXMLElement(
"https://mail.google.com/mail/feed/atom",
null,
true);
print_r($xml);
?>
І я отримую наступні результати, коли я запускаю PHP-код
SimpleXMLElement Object ( [@attributes] => Array ( [version] => 0.3 ) [title] => Gmail - Inbox for EMAIL ADDRESS [tagline] => New messages in your Gmail Inbox [fullcount] => 1 [link] => SimpleXMLElement Object ( [@attributes] => Array ( [rel] => alternate [href] => http://mail.google.com/mail [type] => text/html ) ) [modified] => 2011-10-27T20:12:38Z [entry] => SimpleXMLElement Object ( [title] => SUBJECT [link] => SimpleXMLElement Object ( [@attributes] => Array ( [rel] => alternate [href] => LINK [type] => text/html ) ) [modified] => 2011-10-26T15:45:11Z [issued] => 2011-10-26T15:45:11Z [id] => tag:gmail.google.com,2004:1383746934228011210 [author] => SimpleXMLElement Object ( [name] => Webs [email] => EMAIL ) ) )
Я хочу, щоб результати не відображали "SimpleXMLElement Object" тощо, і відображати лише фактичну корисну інформацію (тему, вміст електронної пошти, дату тощо)
Я спробував використовувати str_replace, але це не працює.