php get url from dropbox - php

I am using the php script dropbox recommended https://github.com/BenTheDesigner, and can get a json response, and also list files.
ie This is an output of files in my developer account from test.php.
This is a list of all files in your [APP] Dropbox.
api_upload_test.txt45 bytes
dsdsdsdsdsdsd0 bytes
ghhhhhhhhhhhh0 bytes
If I Fell - The Beatles.mp31 MB
Koala.jpg762.5 KB
test_download_api_upload_test.txt45 bytes
But I need the absolute url for these files. ie
http://something/sandbox/folder/Koala.jpg
or
http://something/fileget/http://something/koala.jpg
I cannot find anything about specifying a url, or whether I use a dropbox url. Probably a stupid and simple answer.
This is an example of the array;
array(3) {
["code"]=>
string(3) "200"
["body"]=>
object(stdClass)#8 (9) {
["hash"]=>
string(32) "df98863d80aa0c89f5e359a4f3e10b5a"
["thumb_exists"]=>
bool(false)
["bytes"]=>
int(0)
["path"]=>
string(1) "/"
["is_dir"]=>
bool(true)
["size"]=>
string(7) "0 bytes"
["root"]=>
string(10) "app_folder"
["contents"]=>
array(6) {
[0]=>
object(stdClass)#9 (12) {
["revision"]=>
int(1)
["rev"]=>
string(9) "109a31b3c"
["thumb_exists"]=>
bool(false)
["bytes"]=>
int(45)
["modified"]=>
string(31) "Tue, 21 Aug 2012 12:26:04 +0000"
["client_mtime"]=>
string(31) "Tue, 21 Aug 2012 12:26:04 +0000"
["path"]=>
string(20) "/api_upload_test.txt"
["is_dir"]=>
bool(false)
["icon"]=>
string(15) "page_white_text"
["root"]=>
string(7) "dropbox"
["mime_type"]=>
string(10) "text/plain"
["size"]=>
string(8) "45 bytes"
}
[1]=>
object(stdClass)#10 (10) {
["revision"]=>
int(3)
["rev"]=>
string(9) "309a31b3c"
["thumb_exists"]=>
bool(false)
["bytes"]=>
int(0)
["modified"]=>
string(31) "Tue, 21 Aug 2012 14:09:26 +0000"
["path"]=>
string(14) "/dsdsdsdsdsdsd"
["is_dir"]=>
bool(true)
["icon"]=>
string(6) "folder"
["root"]=>
string(7) "dropbox"
["size"]=>
string(7) "0 bytes"
}
[2]=>
object(stdClass)#11 (10) {
["revision"]=>
int(4)
["rev"]=>
string(9) "409a31b3c"
["thumb_exists"]=>
bool(false)
["bytes"]=>
int(0)
["modified"]=>
string(31) "Tue, 21 Aug 2012 15:29:22 +0000"
["path"]=>
string(14) "/ghhhhhhhhhhhh"
["is_dir"]=>
bool(true)
["icon"]=>
string(6) "folder"
["root"]=>
string(7) "dropbox"
["size"]=>
string(7) "0 bytes"
}

Found a way of getting the url. The full path is not given in the array from dropbox. You have to specify media in the request, and the full path is given, which expires every 4 hours.
ie
$media = $dropbox->media($path);

Related

Can't get array of functions for some standard PHP extensions

I'm trying to get an array of function names for extensions Refletion, mysqlnd, xmlreader, Phar, pdo_mysql, xsl using standard get_extension_funcs() but it returns false instead of array of names. This is strange as it returns names for any other module. For example, it works for xmlwriter. But it does not work for xmlreader.
I have PHP 8.0.2. What am I doing wrong? Sample code:
$ php -r "var_dump(get_extension_funcs('xmlreader'));"
bool(false)
$ php -r "var_dump(get_extension_funcs('xmlwriter'));"
array(42) {
[0]=>
string(18) "xmlwriter_open_uri"
[1]=>
string(21) "xmlwriter_open_memory"
[2]=>
string(20) "xmlwriter_set_indent"
[3]=>
string(27) "xmlwriter_set_indent_string"
[4]=>
string(23) "xmlwriter_start_comment"
[5]=>
string(21) "xmlwriter_end_comment"
[6]=>
string(25) "xmlwriter_start_attribute"
[7]=>
string(23) "xmlwriter_end_attribute"
[8]=>
string(25) "xmlwriter_write_attribute"
[9]=>
string(28) "xmlwriter_start_attribute_ns"
[10]=>
string(28) "xmlwriter_write_attribute_ns"
[11]=>
string(23) "xmlwriter_start_element"
[12]=>
string(21) "xmlwriter_end_element"
[13]=>
string(26) "xmlwriter_full_end_element"
[14]=>
string(26) "xmlwriter_start_element_ns"
[15]=>
string(23) "xmlwriter_write_element"
[16]=>
string(26) "xmlwriter_write_element_ns"
[17]=>
string(18) "xmlwriter_start_pi"
[18]=>
string(16) "xmlwriter_end_pi"
[19]=>
string(18) "xmlwriter_write_pi"
[20]=>
string(21) "xmlwriter_start_cdata"
[21]=>
string(19) "xmlwriter_end_cdata"
[22]=>
string(21) "xmlwriter_write_cdata"
[23]=>
string(14) "xmlwriter_text"
[24]=>
string(19) "xmlwriter_write_raw"
[25]=>
string(24) "xmlwriter_start_document"
[26]=>
string(22) "xmlwriter_end_document"
[27]=>
string(23) "xmlwriter_write_comment"
[28]=>
string(19) "xmlwriter_start_dtd"
[29]=>
string(17) "xmlwriter_end_dtd"
[30]=>
string(19) "xmlwriter_write_dtd"
[31]=>
string(27) "xmlwriter_start_dtd_element"
[32]=>
string(25) "xmlwriter_end_dtd_element"
[33]=>
string(27) "xmlwriter_write_dtd_element"
[34]=>
string(27) "xmlwriter_start_dtd_attlist"
[35]=>
string(25) "xmlwriter_end_dtd_attlist"
[36]=>
string(27) "xmlwriter_write_dtd_attlist"
[37]=>
string(26) "xmlwriter_start_dtd_entity"
[38]=>
string(24) "xmlwriter_end_dtd_entity"
[39]=>
string(26) "xmlwriter_write_dtd_entity"
[40]=>
string(23) "xmlwriter_output_memory"
[41]=>
string(15) "xmlwriter_flush"
}
Even if I assume that some extensions does not have any functions, there are some extensions which SHOULD have functions, eg. mysqlnd should have mysqli_fetch_all() as noted in official docs.
Also, I assure that all those extensions are loaded and working fine.
$ php -r "var_dump(extension_loaded('mysqlnd'));"
bool(true)
$ php -r "var_dump(get_extension_funcs('mysqlnd'));"
bool(false)
FALSE is returned if there are no functions in that extension.
For example;
<?php
get_extension_funcs("xmlreader");
Returns;
false
because that extension defines the XMLReader class but not functions.
According JB comment

Printing a specific value in array PHP

I want to output the value of followers_count just once. I managed to this using a foreach loop, however this obviously outputted the result for multiple times. Is there some other simple way I can do this?
the array is declared as follows:
$tweetsshow = $connection->get("https://api.twitter.com/1.1/users/show.json?screen_name=".$twitteruser);
echo $tweetsshow[0]->user->followers_count;
array(30) {
[0]=>
object(stdClass)#5 (24) {
["created_at"]=>
string(30) "Wed May 20 12:32:30 +0000 2015"
["id"]=>
float(6.010025574446E+17)
["id_str"]=>
string(18) "601002557444595712"
["text"]=>
string(79) "Judge Farrugia Sacco loses appeal http://t.co/njcgvTDTej http://t.co/GRjnBt13uC"
["source"]=>
string(71) "Times of Malta"
["truncated"]=>
bool(false)
["in_reply_to_status_id"]=>
NULL
["in_reply_to_status_id_str"]=>
NULL
["in_reply_to_user_id"]=>
NULL
["in_reply_to_user_id_str"]=>
NULL
["in_reply_to_screen_name"]=>
NULL
["user"]=>
object(stdClass)#6 (39) {
["id"]=>
int(390687940)
["id_str"]=>
string(9) "390687940"
["name"]=>
string(14) "Times of Malta"
["screen_name"]=>
string(15) "TheTimesofMalta"
["location"]=>
string(5) "Malta"
["description"]=>
string(74) "General, sporting, and business news for Malta and the surrounding region."
["url"]=>
string(22) "http://t.co/OYjxN0Y4tX"
["description"]=>
object(stdClass)#10 (1) {
["urls"]=>
array(0) {
}
}
}
["protected"]=>
bool(false)
["followers_count"]=>
int(13865)
["friends_count"]=>
int(13)
["listed_count"]=>
int(153)
["created_at"]=>
string(30) "Fri Oct 14 11:20:15 +0000 2011"
["favourites_count"]=>
int(0)
You can just simply do:
echo $array[0]->user->followers_count; //Returns 13865

Exclude Retweets in Twitter Search API 1.1

Here I'm trying to retrieve the tweets which has the tag 'V57' using search api 1.1. Dumped & seen the results of search term by using,
$search_tim = $connection->get('search/tweets',array('q' => ' #V57', 'count' => 5, 'result_type' => 'recent'));
This is the result after doing var_dump :
object(stdClass)#10 (2) {
["statuses"]=>
array(5) {
[0]=>
object(stdClass)#11 (25) {
["metadata"]=>
object(stdClass)#12 (2) {
["result_type"]=>
string(6) "recent"
["iso_language_code"]=>
string(2) "en"
}
["created_at"]=>
string(30) "Wed Feb 12 16:26:35 +0000 2014"
["id"]=>
float(4.33638273555E+17)
["id_str"]=>
string(18) "4336382731354561"
["text"]=>
string(131) "RT #useracc: Plz consult a doctor #V57"
["source"]=>
string(84) "Twitter for Android"
["truncated"]=>
bool(false)
["in_reply_to_status_id"]=>
NULL
["in_reply_to_status_id_str"]=>
NULL
["in_reply_to_user_id"]=>
NULL
["in_reply_to_user_id_str"]=>
NULL
["in_reply_to_screen_name"]=>
NULL
["user"]=>
object(stdClass)#13 (40) {
["id"]=>
int(965892252)
["id_str"]=>
string(9) "965892252"
["name"]=>
string(10) "khan"
["screen_name"]=>
string(10) "khan"
["location"]=>
string(0) ""
["url"]=>
NULL
["entities"]=>
object(stdClass)#14 (1) {
["description"]=>
object(stdClass)#15 (1) {
["urls"]=>
array(0) {
}
}
}
["protected"]=>
bool(false)
["followers_count"]=>
int(457)
["friends_count"]=>
int(500)
["listed_count"]=>
int(3)
["created_at"]=>
string(30) "Fri Nov 23 10:56:08 +0000 2012"
["favourites_count"]=>
int(129)
["utc_offset"]=>
int(19800)
["time_zone"]=>
string(7) "Chennai"
["geo_enabled"]=>
bool(false)
["verified"]=>
bool(false)
["statuses_count"]=>
int(3230)
["lang"]=>
string(2) "en"
["contributors_enabled"]=>
bool(false)
["is_translator"]=>
bool(false)
["is_translation_enabled"]=>
bool(false)
["profile_background_color"]=>
string(6) "0099B9"
["profile_background_image_url"]=>
string(48) "http://abs.twimg.com/images/themes/theme4/bg.gif"
["profile_background_image_url_https"]=>
string(49) "https://abs.twimg.com/images/themes/theme4/bg.gif"
["profile_background_tile"]=>
bool(false)
["profile_image_url"]=>
string(99) "http://pbs.twimg.com/profile_images/3788093993/0639a4b8297f9eea2cbb9de89f5c3a40_normal.jpeg"
["profile_image_url_https"]=>
string(100) "https://pbs.twimg.com/profile_images/37883993/0639a4b8297f9eea2cbb95c3a40_normal.jpeg"
["profile_banner_url"]=>
string(58) "https://pbs.twimg.com/profile_banners/9658922/1386619"
["profile_link_color"]=>
string(6) "0099B9"
["profile_sidebar_border_color"]=>
string(6) "5ED4DC"
["profile_sidebar_fill_color"]=>
string(6) "95E8EC"
["profile_text_color"]=>
string(6) "3C3940"
["profile_use_background_image"]=>
bool(true)
["default_profile"]=>
bool(false)
["default_profile_image"]=>
bool(false)
["following"]=>
bool(false)
["follow_request_sent"]=>
bool(false)
["notifications"]=>
bool(false)
}
["geo"]=>
NULL
["coordinates"]=>
NULL
["place"]=>
NULL
["contributors"]=>
NULL
["retweeted_status"]=>
object(stdClass)#16 (24) {
["metadata"]=>
object(stdClass)#17 (2) {
["result_type"]=>
string(6) "recent"
["iso_language_code"]=>
string(2) "en"
}
["created_at"]=>
string(30) "Wed Feb 12 15:33:36 +0000 2014"
["id"]=>
float(4.3362493936345E+17)
["id_str"]=>
string(18) "43362493446784"
["source"]=>
string(84) "Twitter for Android"
["truncated"]=>
bool(false)
["in_reply_to_status_id"]=>
NULL
["in_reply_to_status_id_str"]=>
NULL
["in_reply_to_user_id"]=>
NULL
["in_reply_to_user_id_str"]=>
NULL
["in_reply_to_screen_name"]=>
NULL
["user"]=>
object(stdClass)#18 (40) {
["id"]=>
int(168362964)
["id_str"]=>
string(9) "168362964"
["name"]=>
string(5) "usracc"
["screen_name"]=>
string(12) "useracc"
["location"]=>
string(16) "India."
["url"]=>
NULL
["entities"]=>
object(stdClass)#19 (1) {
["description"]=>
object(stdClass)#20 (1) {
["urls"]=>
array(0) {
}
}
}
["protected"]=>
bool(false)
["followers_count"]=>
int(651)
["friends_count"]=>
int(197)
["listed_count"]=>
int(6)
["created_at"]=>
string(30) "Mon Jul 19 03:54:15 +0000 2010"
["favourites_count"]=>
int(4267)
["utc_offset"]=>
int(19800)
["time_zone"]=>
string(7) "Chennai"
["geo_enabled"]=>
bool(true)
["verified"]=>
bool(false)
["statuses_count"]=>
int(10177)
["lang"]=>
string(2) "en"
["contributors_enabled"]=>
bool(false)
["is_translator"]=>
bool(false)
["is_translation_enabled"]=>
bool(false)
["profile_background_color"]=>
string(6) "C0DEED"
["profile_background_image_url"]=>
string(48) "http://abs.twimg.com/images/themes/theme1/bg.png"
["profile_background_image_url_https"]=>
string(49) "https://abs.twimg.com/images/themes/theme1/bg.png"
["profile_background_tile"]=>
bool(false)
["profile_image_url"]=>
string(75) "http://pbs.twimg.com/profile_images/4338561184/quFHKeYq_normal.jpeg"
["profile_image_url_https"]=>
string(76) "https://pbs.twimg.com/profile_images/433856131184/quFHKeYq_normal.jpeg"
["profile_banner_url"]=>
string(58) "https://pbs.twimg.com/profile_banners/168364/1392170036"
["profile_link_color"]=>
string(6) "0084B4"
["profile_sidebar_border_color"]=>
string(6) "C0DEED"
["profile_sidebar_fill_color"]=>
string(6) "DDEEF6"
["profile_text_color"]=>
string(6) "333333"
["profile_use_background_image"]=>
bool(true)
["default_profile"]=>
bool(true)
["default_profile_image"]=>
bool(false)
["following"]=>
bool(false)
["follow_request_sent"]=>
bool(false)
["notifications"]=>
bool(false)
}
["geo"]=>
NULL
["coordinates"]=>
NULL
["place"]=>
NULL
["contributors"]=>
NULL
["retweet_count"]=>
int(5)
["favorite_count"]=>
int(10)
["entities"]=>
object(stdClass)#21 (5) {
["hashtags"]=>
array(1) {
[0]=>
object(stdClass)#22 (2) {
["text"]=>
string(7) "v57"
["indices"]=>
array(2) {
[0]=>
int(76)
[1]=>
int(84)
}
}
}
["symbols"]=>
array(0) {
}
["urls"]=>
array(0) {
}
["favorited"]=>
bool(false)
["retweeted"]=>
bool(false)
["possibly_sensitive"]=>
bool(false)
["lang"]=>
string(2) "en"
}
["retweet_count"]=>
int(5)
["favorite_count"]=>
int(0)
Now, i would like to retrieve the original tweets alone which has V57 tag by ignoring all Retweets similar to this
string(131) "RT #useravv: Plz consult a doctor #V57"
I've googled and found this thread. But it was old API version.
My Doubt has been cleared. Thanks to the SO user Newbi3 :)
Here is a way to exclude Retweets in Search api 1.1
$search_tim = $connection->get('search/tweets',array('q' => ' #V57 -RT', 'count' => 5,'result_type' => 'recent'));
Adding -RT at the end of search term will filter it.
EDIT :
The above approach will simply eliminate the tweet too if they included #RT is in their status and username or screename. This will blindly ignore tweets when its sees RT. This is a temporary solution.
The permanent solution is, get the RT status & if if its retweet simply assign a value like 1 to a variable & 0 if its original. Eg..
if (isset($tweet_object->retweeted_status)) {
// This is a retweet
// Use the original tweet's entities, they are more complete
$entities = $tweet_object->retweeted_status->entities;
$is_rt = 1; // Set 1 if retweeted
} else {
$entities = $tweet_object->entities;
$is_rt = 0; // Set 0 if original
}
Then just do like,
if($is_rt==0) // if its a original tweet
{
...
....
}
I have found concatenating "-filter:retweets" to the end of your query string works best.
If you simply add -RT you might run into issues with accidentally filtering tweets containing "RT" for example "Russia Today" will use that string quite a lot!
The following pages describe Twitter search operators:
https://support.twitter.com/articles/71577-using-advanced-search
http://thesocialchic.com/2013/04/26/how-to-master-twitter-search/

read_exif_data & ApertureFNumber

I've recently come across the php function exif_read_data - which is pretty awesome. I'm using it on my photography site, and while it works pretty well, I'm struggling to work out why ApertureFNumber isn't working. The code I'm using is:
$exif_data = exif_read_data($image[0]);
echo $exif_data['Model'];
echo $exif_data['ExposureTime'];
echo $exif_data['FNumber'];
echo $exif_data['ApertureFNumber'];
echo $exif_data['ISOSpeedRatings'];
echo $exif_data['DateTime'];
(styling removed)
I used FNumber as well as ApertureFNumber for testing because FNumber works, while ApertureFNumberjust returns blank. All the other fields work fine.
I did a var_dump of $exif_data - and this is what I get (the abridged version):
["ApertureFNumber"]=> string(5) "f/3.5"
["FNumber"]=> string(5) "35/10"
What have I missed that FNumber works, but ApertureFNumber doesn't?
--
EDIT - Complete var_dump added as requested
array(52) { ["FileName"]=> string(18) "MYD-67-900x602.jpg" ["FileDateTime"]=> int(0) ["FileSize"]=> int(123278) ["FileType"]=> int(2) ["MimeType"]=> string(10) "image/jpeg" ["SectionsFound"]=> string(30) "ANY_TAG, IFD0, THUMBNAIL, EXIF" ["COMPUTED"]=> array(9) { ["html"]=> string(24) "width="900" height="602"" ["Height"]=> int(602) ["Width"]=> int(900) ["IsColor"]=> int(1) ["ByteOrderMotorola"]=> int(0) ["ApertureFNumber"]=> string(5) "f/3.5" ["FocusDistance"]=> string(14) "4294967296.00m" ["Thumbnail.FileType"]=> int(2) ["Thumbnail.MimeType"]=> string(10) "image/jpeg" } ["Make"]=> string(17) "NIKON CORPORATION" ["Model"]=> string(9) "NIKON D60" ["XResolution"]=> string(5) "200/1" ["YResolution"]=> string(5) "200/1" ["ResolutionUnit"]=> int(2) ["Software"]=> string(41) "Adobe Photoshop Lightroom 4.4 (Macintosh)" ["DateTime"]=> string(19) "2013:07:06 10:07:40" ["Exif_IFD_Pointer"]=> int(216) ["THUMBNAIL"]=> array(6) { ["Compression"]=> int(6) ["XResolution"]=> string(5) "200/1" ["YResolution"]=> string(5) "200/1" ["ResolutionUnit"]=> int(2) ["JPEGInterchangeFormat"]=> int(932) ["JPEGInterchangeFormatLength"]=> int(8995) } ["ExposureTime"]=> string(5) "1/800" ["FNumber"]=> string(5) "35/10" ["ExposureProgram"]=> int(1) ["ISOSpeedRatings"]=> int(100) ["ExifVersion"]=> string(4) "0230" ["DateTimeOriginal"]=> string(19) "2008:10:30 16:04:34" ["DateTimeDigitized"]=> string(19) "2008:10:30 16:04:34" ["ShutterSpeedValue"]=> string(15) "9643856/1000000" ["ApertureValue"]=> string(13) "361471/100000" ["ExposureBiasValue"]=> string(3) "0/6" ["MaxApertureValue"]=> string(5) "36/10" ["SubjectDistance"]=> string(4) "-1/1" ["MeteringMode"]=> int(5) ["LightSource"]=> int(0) ["Flash"]=> int(0) ["FocalLength"]=> string(4) "18/1" ["SubSecTimeOriginal"]=> string(2) "50" ["SubSecTimeDigitized"]=> string(2) "50" ["SensingMethod"]=> int(2) ["FileSource"]=> string(1) "" ["SceneType"]=> string(1) "" ["CFAPattern"]=> string(8) "" ["CustomRendered"]=> int(0) ["ExposureMode"]=> int(1) ["WhiteBalance"]=> int(0) ["DigitalZoomRatio"]=> string(3) "1/1" ["FocalLengthIn35mmFilm"]=> int(27) ["SceneCaptureType"]=> int(0) ["GainControl"]=> int(0) ["Contrast"]=> int(0) ["Saturation"]=> int(0) ["Sharpness"]=> int(0) ["SubjectDistanceRange"]=> int(0) ["UndefinedTag:0xA431"]=> string(7) "6265825" ["UndefinedTag:0xA432"]=> array(4) { [0]=> string(4) "18/1" [1]=> string(4) "55/1" [2]=> string(5) "35/10" [3]=> string(5) "56/10" } ["UndefinedTag:0xA434"]=> string(22) "18.0-55.0 mm f/3.5-5.6" }
Try This:
$exif = exif_read_data($image[0]);
foreach($exif as $exif_data){
echo $exif_data['Model']."<br/>";
echo $exif_data['ExposureTime']."<br/>";
echo $exif_data['FNumber']."<br/>";
echo "ApertureFNumber is:" .$exif_data['ApertureFNumber']."<br/>";
echo $exif_data['ISOSpeedRatings']."<br/>";
echo $exif_data['DateTime']."<br/>";
}
So, I got this figured out now - and thought you might like to see the answer.
The var_dump was giving the data ["ApertureFNumber"]=> string(5) "f/3.5", but wasn't really getting me anywhere, so instead I used print_r($exif_data). That printed out a whole load of useful data including the following:
[COMPUTED] => Array
(
[html] => width="1000" height="667"
[Height] => 667
[Width] => 1000
[IsColor] => 1
[ByteOrderMotorola] => 0
[ApertureFNumber] => f/3.5
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] => image/jpeg
[Thumbnail.Height] => 171
[Thumbnail.Width] => 256
)
So, to echo out the needed ApertureFNumber I simply used echo $exif['COMPUTED']['ApertureFNumber']; It also works for any of the information in the printed array.
Hopefully this helps someone else in the future.

Milti dimentional XML parsing: Getting values using PHP

var_dump result after parsing the XML is
array(2) {
["link"]=>
object(SimpleXMLElement)#3 (1) {
[0]=>
string(24) "http://www.domain.com"
}
["items"]=>
array(10) {
[0]=>
object(SimpleXMLElement)#4 (9) {
["title"]=>
string(32) "The Car Pro Show 4-20-13 Hour 1"
["link"]=>
string(131) "http://www.domain.com/the-car-pro-show-4-20-13-hour-1?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-4-20-13-hour-1"
["comments"]=>
string(65) "http://www.domain.com/the-car-pro-show-4-20-13-hour-1#comments"
["pubDate"]=>
string(31) "Sat, 20 Apr 2013 19:47:08 +0000"
["category"]=>
object(SimpleXMLElement)#2 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=11118"
["description"]=>
string(89) "… Read moreThe post The Car Pro Show 4-20-13 Hour 1 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#14 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(68) "http://www.domain.com/wp-content/uploads/2013/04/42013-Hour-1.mp3"
["length"]=>
string(8) "37202230"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "4 days ago"
}
[1]=>
object(SimpleXMLElement)#5 (9) {
["title"]=>
string(32) "The Car Pro Show 4-20-13 Hour 2"
["link"]=>
string(131) "http://www.domain.com/the-car-pro-show-4-20-13-hour-2?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-4-20-13-hour-2"
["comments"]=>
string(65) "http://www.domain.com/the-car-pro-show-4-20-13-hour-2#comments"
["pubDate"]=>
string(31) "Sat, 20 Apr 2013 19:45:46 +0000"
["category"]=>
object(SimpleXMLElement)#14 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=11116"
["description"]=>
string(89) "… Read moreThe post The Car Pro Show 4-20-13 Hour 2 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#2 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(68) "http://www.domain.com/wp-content/uploads/2013/04/42013-Hour-2.mp3"
["length"]=>
string(8) "37151773"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "4 days ago"
}
[2]=>
object(SimpleXMLElement)#6 (9) {
["title"]=>
string(32) "The Car Pro Show 4-20-13 Hour 3"
["link"]=>
string(131) "http://www.domain.com/the-car-pro-show-4-20-13-hour-3?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-4-20-13-hour-3"
["comments"]=>
string(65) "http://www.domain.com/the-car-pro-show-4-20-13-hour-3#comments"
["pubDate"]=>
string(31) "Sat, 20 Apr 2013 19:44:28 +0000"
["category"]=>
object(SimpleXMLElement)#2 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=11114"
["description"]=>
string(89) "… Read moreThe post The Car Pro Show 4-20-13 Hour 3 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#14 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(68) "http://www.domain.com/wp-content/uploads/2013/04/42013-Hour-3.mp3"
["length"]=>
string(8) "37135093"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "4 days ago"
}
[3]=>
object(SimpleXMLElement)#7 (9) {
["title"]=>
string(37) "The Car Pro Show 4-20-13 Network Feed"
["link"]=>
string(143) "http://www.domain.com/the-car-pro-show-4-20-13-network-feed?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-4-20-13-network-feed"
["comments"]=>
string(71) "http://www.domain.com/the-car-pro-show-4-20-13-network-feed#comments"
["pubDate"]=>
string(31) "Sat, 20 Apr 2013 19:27:54 +0000"
["category"]=>
object(SimpleXMLElement)#14 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=11109"
["description"]=>
string(94) "… Read moreThe post The Car Pro Show 4-20-13 Network Feed appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#2 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(61) "http://www.domain.com/wp-content/uploads/2013/04/42013.mp3"
["length"]=>
string(8) "84805120"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "4 days ago"
}
[4]=>
object(SimpleXMLElement)#8 (9) {
["title"]=>
string(32) "The Car Pro Show 4-13-13 Hour 1"
["link"]=>
string(131) "http://www.domain.com/the-car-pro-show-4-13-13-hour-1?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-4-13-13-hour-1"
["comments"]=>
string(65) "http://www.domain.com/the-car-pro-show-4-13-13-hour-1#comments"
["pubDate"]=>
string(31) "Sat, 13 Apr 2013 19:48:44 +0000"
["category"]=>
object(SimpleXMLElement)#2 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=10968"
["description"]=>
string(89) "… Read moreThe post The Car Pro Show 4-13-13 Hour 1 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#14 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(68) "http://www.domain.com/wp-content/uploads/2013/04/41313-Hour-1.mp3"
["length"]=>
string(8) "37394467"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "1 week ago"
}
[5]=>
object(SimpleXMLElement)#9 (9) {
["title"]=>
string(32) "The Car Pro Show 4-13-13 Hour 2"
["link"]=>
string(131) "http://www.domain.com/the-car-pro-show-4-13-13-hour-2?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-4-13-13-hour-2"
["comments"]=>
string(65) "http://www.domain.com/the-car-pro-show-4-13-13-hour-2#comments"
["pubDate"]=>
string(31) "Sat, 13 Apr 2013 19:47:18 +0000"
["category"]=>
object(SimpleXMLElement)#14 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=10966"
["description"]=>
string(89) "… Read moreThe post The Car Pro Show 4-13-13 Hour 2 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#2 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(68) "http://www.domain.com/wp-content/uploads/2013/04/41313-Hour-2.mp3"
["length"]=>
string(8) "37177627"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "1 week ago"
}
[6]=>
object(SimpleXMLElement)#10 (9) {
["title"]=>
string(32) "The Car Pro Show 4-13-13 Hour 3"
["link"]=>
string(131) "http://www.domain.com/the-car-pro-show-4-13-13-hour-3?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-4-13-13-hour-3"
["comments"]=>
string(65) "http://www.domain.com/the-car-pro-show-4-13-13-hour-3#comments"
["pubDate"]=>
string(31) "Sat, 13 Apr 2013 19:45:55 +0000"
["category"]=>
object(SimpleXMLElement)#2 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=10964"
["description"]=>
string(89) "… Read moreThe post The Car Pro Show 4-13-13 Hour 3 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#14 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(68) "http://www.domain.com/wp-content/uploads/2013/04/41313-Hour-3.mp3"
["length"]=>
string(8) "36899488"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "1 week ago"
}
[7]=>
object(SimpleXMLElement)#11 (9) {
["title"]=>
string(38) "The Car Pro Show Network Feed 4-13-13"
["link"]=>
string(143) "http://www.domain.com/the-car-pro-show-network-feed-4-13-13?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-network-feed-4-13-13"
["comments"]=>
string(71) "http://www.domain.com/the-car-pro-show-network-feed-4-13-13#comments"
["pubDate"]=>
string(31) "Sat, 13 Apr 2013 19:17:07 +0000"
["category"]=>
object(SimpleXMLElement)#14 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=10958"
["description"]=>
string(95) "… Read moreThe post The Car Pro Show Network Feed 4-13-13 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#2 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(61) "http://www.domain.com/wp-content/uploads/2013/04/41313.mp3"
["length"]=>
string(8) "83924992"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(10) "1 week ago"
}
[8]=>
object(SimpleXMLElement)#12 (9) {
["title"]=>
string(31) "The Car Pro Show Hour 1 4-6-13"
["link"]=>
string(129) "http://www.domain.com/the-car-pro-show-hour-1-4-6-13?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-hour-1-4-6-13"
["comments"]=>
string(64) "http://www.domain.com/the-car-pro-show-hour-1-4-6-13#comments"
["pubDate"]=>
string(31) "Sat, 06 Apr 2013 19:45:57 +0000"
["category"]=>
object(SimpleXMLElement)#2 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=10824"
["description"]=>
string(88) "… Read moreThe post The Car Pro Show Hour 1 4-6-13 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#14 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(67) "http://www.domain.com/wp-content/uploads/2013/04/4613-Hour-1.mp3"
["length"]=>
string(8) "37239760"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(11) "2 weeks ago"
}
[9]=>
object(SimpleXMLElement)#13 (9) {
["title"]=>
string(31) "The Car Pro Show Hour 2 4-6-13"
["link"]=>
string(129) "http://www.domain.com/the-car-pro-show-hour-2-4-6-13?utm_source=rss&utm_medium=rss&utm_campaign=the-car-pro-show-hour-2-4-6-13"
["comments"]=>
string(64) "http://www.domain.com/the-car-pro-show-hour-2-4-6-13#comments"
["pubDate"]=>
string(31) "Sat, 06 Apr 2013 19:44:42 +0000"
["category"]=>
object(SimpleXMLElement)#14 (0) {
}
["guid"]=>
string(33) "http://www.domain.com/?p=10822"
["description"]=>
string(88) "… Read moreThe post The Car Pro Show Hour 2 4-6-13 appeared first on Car Pro USA."
["enclosure"]=>
object(SimpleXMLElement)#2 (1) {
["#attributes"]=>
array(3) {
["url"]=>
string(67) "http://www.domain.com/wp-content/uploads/2013/04/4613-Hour-2.mp3"
["length"]=>
string(8) "37202647"
["type"]=>
string(10) "audio/mpeg"
}
}
["updated"]=>
string(11) "2 weeks ago"
}
}
}
I want to get values, like Title, Date & URL. Easily I can retrieve title and date, PHP code is:
<?php foreach($entries['items'] as $entry) { ?>
Title: <?php echo $entry->title; ?>
Date: <?php echo date("M d Y",strtotime($entry->pubDate)); ?>
URL: <?php echo $entry->url ?>
<?php } ?>
But I cannot get value of URL here, how can I get that?
You can get it using attributes() method.
$attrs = $entry->enclosure->attributes();
echo $attrs['url'];

Categories