Get users yahoo email - oauth

I think this yahoo email of users is little problem with yahoo and twitter.
I have searched many days for this but no luck.
Im getting user details like that
print( $profile->location) ; --------got location
print( $profile->gender) ; --------- got gender
But when i want to get the email i couldnt .
Have tried this
print( $profile->emails->handle) ;
But i got this error
Notice: Trying to get property of non-object in mywebsite/index.php on line 103
Have tried this
print( $profile->emails['handle']) ; -----no luck
I have seen this but it seems there are many emails .
How can i get the main email ?
Thanks
EDIT:
i have tryed this
foreach($profile->emails as $k){
echo 'handle: ' . $k->handle . ' -----> i got error here 'Undefined property: stdClass::$handle'
id: ' . $k->id . ' -----> i got the id (no error)
type: ' . $k->type . '<br>'; -----> i got the type (no error)
}
i dont know why handle returns error always . is something wrong with handle ?
EDIT2:
i have made this:
var_dump($profile);
and it gives this
object(stdClass)#14 (20)
{ ["uri"]=> string(70)
"http://social.yahooapis.com/v1/user/1JKK3SDVWE6QDPAQRVUFRN7NDU/profile"
["guid"]=> string(26) "1J4K3SDVSW6QDPQQRVU1RN7NDO"
["birthYear"]=> int(1977)
["birthdate"]=> string(3) "12/8"
["created"]=> string(20) "2006-10-08T10:32:21Z"
["displayAge"]=> int(37)
["emails"]=> array(1) { [0]=> object(stdClass)#22 (3) { ["id"]=> int(3)
["primary"]=> bool(true)
["type"]=> string(4) "HOME"} }
["familyName"]=> string(0) ""
["gender"]=> string(1) "M"
["givenName"]=> string(0) ""
["image"]=> object(stdClass)#23 (4) { ["height"]=> int(192)
["imageUrl"]=> string(55) "http://l.yimg.com/dh/ap/social/profile/profile_U197.png"
["size"]=> string(7) "192x192"
["width"]=> int(192) }
["lang"]=> string(5) "en-UK"
["location"]=> string(31) "NA, Indisponible ENGLAND 16548"
["memberSince"]=> string(20) "2003-05-10T21:34:41Z"
["nickname"]=> string(5) "diFirst"
["profileUrl"]=> string(51) "http://profile.yahoo.com/1J4K3SDVSE6ADPQQRVJFRN7ND1" ["searchable"]=> bool(true)
["timeZone"]=> string(12) "Europe/ENGLAND"
["updated"]=> string(20) "2012-09-21T14:35:30Z"
["isConnected"]=> bool(false)
}

Related

JSON.parse(message) fails but "https://jsonlint.com/" shows that the message is valid. Why does this happen?

It fails here,
message = "{\"response\":{\"billDetails\":\"[{\"name\":\"Account ID\"}]\"}}"
JSON.parse(message)
JSON::ParserError (809: unexpected token at '{"response":{"billDetails":"[{"name":"Account ID"}]"}}')
I'm not sure this will be helpful. But your json string should be written from
"{
"response":{
"billDetails": "[{"name":"Account ID"}]"}
}"
To:
'{
"response":{
"billDetails": [{"name":"Account ID"}]
}
}'
In the array from billDetails, you have two aditional ", that provokes an error when parsing that string.

Parse error: syntax error, unexpected '['

Was trying to install a wp plugin- dt world clock and got this error msg.
The actual error msg:
Parse error: syntax error, unexpected '[' in /var/www/html/wp-content/plugins/dt-world-clock/dt-world-clock.php on line 415
And the line 415 is:
function DT_World_Clock_Shortcode($atts = [], $content = null, $tag = '') {
I have no idea where to edit-
Would really appreciate help...
try this
function DT_World_Clock_Shortcode($atts = array(), $content = null, $tag = "") {

Lua: "attempt to concatenate global" Error in MPV

I am trying to write a little script to output filetags in mpv. My script looks like this:
require 'os'
require 'string'
function displayTrack()
currentTrack = mp.get_property("metadata/by-key/Title")
currentArtist = mp.get_property("metadata/by-key/Artist")
currentAlbum = mp.get_property("metadata/by-key/Album")
print(currentArtist)
print(currentAlbum)
print(currentTrack)
if currentTrack == nil then
os.execute("terminal-notifier -title '" .. currentArtist .. "' -message 'Unknown Title'")
else
os.execute("terminal-notifier -title '" .. currentArtist .. "' -message '" .. currentAlbum .. " - " .. currentTrack .. "'")
end
end
mp.observe_property("eof-reached", "bool", displayTrack)
Catching the tags and printing them works with every tested title. But if i want to uncomment the 5 lines starting with "if currentTrack == nil ..." so it also dislpays a native notification i get the LUA error:
/Users/marcel/.config/mpv/scripts/notification.lua:15: attempt to concatenate global 'currentArtist' (a nil value)
Can somebody tell me why i can print the string but not forward it to the os.execute?
It is not os.execute, it is concatenation - .. - that can't work with nil. And yes, you can print standalone nil just fine. In your case not only currentTrack is nil, but currentArtist too, so you can't build a string with it. Consider if you even need those entries where you don't have value for currentArtist and either skip them, provide alternative if branch to do something else or provide some default in concatenation. Usual idiom is (currentArtist or '') - here your default will be empty string.
if currentTrack == nil then
os.execute("terminal-notifier -title '" .. currentArtist .. "' -message 'Unknown Title'")
If this branch gets executed, currentTrack is nil, thus the concatenation fails as stated by the error message.
Just get rid of the concatenation all together:
if currentTrack == nil then
os.execute("terminal-notifier -title -message 'Unknown Title'")

Using flourish lib, double quotes in email subject are not fetched: FETCH command issue

When I check with the FETCH command, I get like this:
2148 FETCH (UID 2159 INTERNALDATE "06-Nov-2013 06:36:15 +0000" RFC822.SIZE 3702 ENVELOPE ("Wed, 6 Nov 2013 12:06:39 +0530" {19} Reg: "test subject" (("karthick kumar" NIL "ngkarthick" "aroxo.com")) (("karthick kumar" NIL "ngkarthick" "aroxo.com")) (("karthick kumar" NIL "ngkarthick" "aroxo.com")) ((NIL NIL "phpkarthick" "gmail.com")) NIL NIL NIL ""))
There is some thing unwanted {19} in fetch command
The {19} followed by a CRLF is called a literal. It says the next 19 characters are to read and fetched without any additional interpretation. They are part of the IMAP protocol, and they are one way that strings with difficult characters can be transferred. They are used to transmit bodies, usually, since they tend to have CRLFs of their own.
In this case, the server has decided to transfer the subject like this, so it doesn't have to escape the quotes, that would otherwise be significant to the protocol.
Perhaps your library is not entirely protocol compliant?
i had solved this issue by doing some pattern replace and successfully resolved and fetch all Email ,
below are my code which help me achive this
please add this code to fMailbox.php after the line
$output = array();
line no nearly 1117
$response = $this -> write('FETCH ' . $messages . ' (UID INTERNALDATE RFC822.SIZE ENVELOPE)');
$hintter = implode(' ', $response);
$pattern = '(\{[0-9]+\})';
if (preg_match($pattern, $hintter, $match)) {
$responses = preg_replace($pattern, '', $response);
$responsesnew = array();
$i = 0;
$j = 0;
foreach ($responses as $reps) {
if (substr(trim($reps), 0, 1) != '*') {
$responsesnew[$i] = $responses[$j - 1] . $reps;
$i++;
}
$j++;
}
} else {
$responsesnew = $response;
}
and change the foreach parameters to
foreach ($responsesnew as $line)
from
foreach ($responsesnew as $line)

PHP 5.3.10: var_dump does not print readable results as it used to be

After I have upgraded my localhost wamp server to php 5.3.10, the var_dump does not print results that are as readable/pretty as they used to be.
$obj = (object) array('qualitypoint', 'technologies', 'India');
var_dump($obj);
object(stdClass)#2 (3) { [0]=> string(12) "qualitypoint" [1]=> string(12) "technologies" [2]=> string(5) "India" }
As you can see that everything now is cramp into one line.
It used to print something like this below though,
object(stdClass)#1 (3) {
[0]=> string(12) "qualitypoint"
[1]=> string(12) "technologies"
[2]=> string(5) "India"
}
How can I make var_dump to return a readable formatted result?
object(stdClass)#2 (3) { [0]=> string(12) "qualitypoint" [1]=> string(12) "technologies" [2]=> string(5) "India" }
Is normal PHP output for this code:
$obj = (object) array('qualitypoint', 'technologies', 'India');
var_dump($obj);
For more readable format You probably used Xdebug extension for PHP.
Check You PHP extensions directory (PHP directory/ext/ on Windows).
If there is not file with name like this:
php_xdebug-X.X.X-X.X-vcX.dll
Download one for You PHP version
Put it in extensions directory add to PHP configuration (php.ini file) bellow other PHP extensions.
Example:
zend_extension=PHP_EXTENSIONS_ABSOLUTE_PATH\php_xdebug-2.1.2-5.3-vc9.dll
Restart Apache and var_dump() output will be formatted like this:
object(stdClass)[1]
string 'qualitypoint' (length=12)
string 'technologies' (length=12)
string 'India' (length=5)
Try:
echo '<pre>';
var_dump($obj);
echo '</pre>';

Resources