I have the following array
Array
(
[responseData] => Array
(
[results] => Array
(
[0] => Array
(
[GsearchResultClass] => GwebSearch
[unescapedUrl] => http://en.wikipedia.org/wiki/JH_(hash_function)
[url] => http://en.wikipedia.org/wiki/JH_(hash_function)
[visibleUrl] => en.wikipedia.org
[cacheUrl] => http://www.google.com/search?q=cache:jxOefvJSQXUJ:en.wikipedia.org
[title] => JH (hash function) - Wikipedia, the free encyclopedia
[titleNoFormatting] => JH (hash function) - Wikipedia, the free encyclopedia
[content] => JH is a cryptographic hash function submitted to the NIST hash function competition by Hongjun Wu. Though chosen as one of the five finalists of the competition ...
)
[1] => Array
(
[GsearchResultClass] => GwebSearch
[unescapedUrl] => http://www.jhaudio.com/
[url] => http://www.jhaudio.com/
[visibleUrl] => www.jhaudio.com
[cacheUrl] => http://www.google.com/search?q=cache:rO6NylpvTx8J:www.jhaudio.com
[title] => JH Audio: Custom In-Ear Monitors | In Ear Monitor
[titleNoFormatting] => JH Audio: Custom In-Ear Monitors | In Ear Monitor
[content] => Custom In-Ear Monitors by JHAudio - manufacturers of premium custom in ear monitors. JH Audio's products are a direct result of 25 years of live audio mixing ...
)
[2] => Array
(
[GsearchResultClass] => GwebSearch
[unescapedUrl] => http://www.jhaudio.com/collection/jha-pro-music-products
[url] => http://www.jhaudio.com/collection/jha-pro-music-products
[visibleUrl] => www.jhaudio.com
[cacheUrl] => http://www.google.com/search?q=cache:YY9q-E00yKkJ:www.jhaudio.com
[title] => JHA Pro Music Products | Custom In-Ear Monitors by JH Audio
[titleNoFormatting] => JHA Pro Music Products | Custom In-Ear Monitors by JH Audio
[content] => JHA Pro Music Products by JHAudio - manufacturers of premium custom in ear monitors. JH Audio's products are a direct result of 25 years of live audio mixing ...
)
[3] => Array
(
[GsearchResultClass] => GwebSearch
[unescapedUrl] => http://www.youtube.com/watch?v=JsQN3yZjRCI
[url] => http://www.youtube.com/watch%3Fv%3DJsQN3yZjRCI
[visibleUrl] => www.youtube.com
[cacheUrl] => http://www.google.com/search?q=cache:Dk4oETmQLNEJ:www.youtube.com
[title] => monta equina zagalo de j.h x gitana de la fortuna - YouTube
[titleNoFormatting] => monta equina zagalo de j.h x gitana de la fortuna - YouTube
[content] => Mar 5, 2010 ... caballos de exposicion en la modalidad de trote y galope, fecha de monta 1 de febrero de 2010....
)
)
I'm trying to parse it in php using a foreach loop so the url, title and content will be shown. However I can't seem to parse the code properly. The code below gives me an error that 'responsedata' isin't recognisied.
foreach($json as value)
echo $value [responsedata];
When I leave it at echo $value, it gives me the number 200, which is the value of responsestatus. When I try
foreach( $json =>url => title => content as $value)
it won't recognise the '=' sign.
Any ideas?? I'm not overly familiar with JSON or php if you havn't gotten that from the post:)
TIA
FTR, what you posted is a native array, not a "json array", try this:
$rawArray = get_results_somehow();
// Flatten the array to make it easier to work with
$results = $rawArray['responseData']['results'];
foreach ($results as $result) {
// Should now see the expected values
var_dump($result);
}
That data is already in array form. You need to iterate on $array['responseData']['results'] like this.
$arr = $array['responseData']['results'];
foreach($arr as $k){
echo $k['url'];
echo $k['title'];
echo $k['content'];
}
Related
My application allows users to upload an image with "embedded" captions. These captions are taken from the exif data:
foreach (exif_read_data('image.jpg', 0, true) as $key => $section) {
foreach ($section as $name => $val) {
if ($key == 'IFD0' && $name == 'Title') {
$caption = $val;
break;
}
}
if ($caption !== '') { break; }
}
//save $caption to database
The images are displayed along with their captions. Each image's caption is rendered 2 times:
title attribute of an <a> that is wrapped around the image
in a div that contains the caption
This is the result:
<a title="T?h?i?s? ?i?s? ?a? ?c?a?p?t?i?o?n?" href="#"><img src="image.jpg"></a>
<div class="caption">This is a caption.</div>
As you can see, when the caption is inside the title attribute, question marks appear. Why is this so?
I would note that I have made the whole application work with utf8 (database, html pages). I have also tried to utf8_encode() the extracted caption before saving it into the database, to no avail.
Any ideas?
EDIT:
By the way, the reason for using an <a> is so that the image appears in a jQuery lightbox when clicked.
EDIT:
#tpaksu, here is an actual dump of the result of exif_read_data('image.jpg', 0, true)
Array
(
[FILE] => Array
(
[FileName] => 174.jpg
[FileDateTime] => 1332196128
[FileSize] => 236179
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, EXIF, GPS, WINXP
)
[COMPUTED] => Array
(
[html] => width="640" height="427"
[Height] => 427
[Width] => 640
[IsColor] => 1
[ByteOrderMotorola] => 1
[CCDWidth] => 9mm
[ApertureFNumber] => f/11.0
[UserComment] =>
[UserCommentEncoding] => UNDEFINED
)
[IFD0] => Array
(
[ImageDescription] => STATE OF CALAMITY/FEB. 2, 2012: Firemen and residents of sitio San Roque in Talisay City help each other in putting off the fire. The Talisay City council wants to declare sitio Laray in a state of calamity.(CDN PHOTO/JUNJIE MENDOZA)
[Make] => Canon
[Model] => Canon EOS 50D
[Orientation] => 1
[Software] => Adobe Photoshop CS2 Windows
[DateTime] => 2012:02:04 18:54:15
[YCbCrPositioning] => 1
[UndefinedTag:0x1001] => 4752
[UndefinedTag:0x1002] => 3168
[Exif_IFD_Pointer] => 2544
[GPS_IFD_Pointer] => 5304
[Title] => S�T�A�T�E� �O�F� �C�A�L�A�M�I�T�Y�/�F�E�B�.� �2�,� �2�0�1�2�:� �F�i�r�e�m�e�n� �a�n�d� �r�e�s�i�d�e�n�t�s� �o�f� �s�i�t�i�o� �S�a�n� �R�o�q�u�e� �i�n� �T�a�l�i�s�a�y� �C�i�t�y� �h�e�l�p� �e�a�c�h� �o�t�h�e�r� �i�n� �p�u�t�t�i�n�g� �o�f�f� �t�h�e� �f�i�r�e�.� �T�h�e� �T�a�l�i�s�a�y� �C�i�t�y� �c�o�u�n�c�i�l� �w�a�n�t�s� �t�o� �d�e�c�l�a�r�e� �s�i�t�i�o� �L�a�r�a�y� �i�n� �a� �s�t�a�t�e� �o�f� �c�a�l�a�m�i�t�y�.�(�C�D�N� �P�H�O�T�O�/�J�U�N�J�I�E� �M�E�N�D�O�Z�A�)���
[Subject] => S�T�A�T�E� �O�F� �C�A�L�A�M�I�T�Y�/�F�E�B�.� �2�,� �2�0�1�2�:� �F�i�r�e�m�e�n� �a�n�d� �r�e�s�i�d�e�n�t�s� �o�f� �s�i�t�i�o� �S�a�n� �R�o�q�u�e� �i�n� �T�a�l�i�s�a�y� �C�i�t�y� �h�e�l�p� �e�a�c�h� �o�t�h�e�r� �i�n� �p�u�t�t�i�n�g� �o�f�f� �t�h�e� �f�i�r�e�.� �T�h�e� �T�a�l�i�s�a�y� �C�i�t�y� �c�o�u�n�c�i�l� �w�a�n�t�s� �t�o� �d�e�c�l�a�r�e� �s�i�t�i�o� �L�a�r�a�y� �i�n� �a� �s�t�a�t�e� �o�f� �c�a�l�a�m�i�t�y�.�(�C�D�N� �P�H�O�T�O�/�J�U�N�J�I�E� �M�E�N�D�O�Z�A�)���
[UndefinedTag:0xEA1C] => �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
)
[EXIF] => Array
(
[ExposureTime] => 1/125
[FNumber] => 11/1
[ISOSpeedRatings] => 400
[ExifVersion] => 0221
[DateTimeOriginal] => 2012:02:02 12:40:00
[DateTimeDigitized] => 2012:02:02 12:40:00
[ComponentsConfiguration] => �
[ShutterSpeedValue] => 458752/65536
[ApertureValue] => 458752/65536
[ExposureBiasValue] => 0/1
[Flash] => 16
[FocalLength] => 16/1
[UserComment] => ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
[SubSecTimeOriginal] => 00
[SubSecTimeDigitized] => 00
[FlashPixVersion] => 0100
[ColorSpace] => 1
[ExifImageWidth] => 2000
[ExifImageLength] => 1333
[FocalPlaneXResolution] => 4752000/894
[FocalPlaneYResolution] => 3168000/597
[FocalPlaneResolutionUnit] => 2
[CustomRendered] => 0
[ExposureMode] => 1
[WhiteBalance] => 0
[SceneCaptureType] => 0
[UndefinedTag:0xEA1C] => �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
)
[GPS] => Array
(
[GPSVersion] => ��
)
[WINXP] => Array
(
[Title] => STATE OF CALAMITY/FEB. 2, 2012: Firemen and residents of sitio San Roque in Talisay City help each other in putting off the fire. The Talisay City council wants to declare sitio Laray in a state of calamity.(CDN PHOTO/JUNJIE MENDOZA)
[Subject] => STATE OF CALAMITY/FEB. 2, 2012: Firemen and residents of sitio San Roque in Talisay City help each other in putting off the fire. The Talisay City council wants to declare sitio Laray in a state of calamity.(CDN PHOTO/JUNJIE MENDOZA)
)
)
Windows 7 seems to encode IFD0 tags using UTF-16 Little Endian, so you can also try parsing those values with iconv() and trim() the resulting string just in case:
$exif_data = exif_read_data( $file, NULL, true, false );
if ( isset( $exif_data['IFD0'] ) ) {
$title = trim(iconv('UTF-16LE','UTF-8',$ifd0['Title']));
}
Of course it would be wise to make sure your system provides UTF-16LE and UTF-8
Ok try this inside your code.
if ($key == 'IFD0' && $name == 'Title') {
if(strpos($val,"�")>0){
for($i=0;$i<len($val);$i++){
$newval.=$val[i];
$i++;
}
}
$caption = $val;
break;
}
or
if ($key == 'IFD0' && $name == 'Title') {
$caption = preg_replace('/[^(\x20-\x7F)]*/','', $val);
break;
}
Array ( [0] => [[["15:30"," ","Alemania","Germany"," Bundesliga: ","Bayer Leverkusen - SC Freiburg"]]] [1] => [[["15:30"," ","Polonia","Poland"," Ekstraklasa: ","MKS Sandecja Nowy Sacz - Termalica Bruk-Bet Nieciecza"]]] [2] => [[["15:30"," ","Rusia","Russia"," Premier League: ","FC Rubin Kazan - FC Ural Yekaterinburg"]]] [3] => [[["16:00"," ","Albania","Albania"," Kategoria Superiore: ","KF Laci - Luftetari Gjirokaster"]]] [4] => [[["16:00"," ","Brasil","Brazil"," Brasileir\u00e3o Serie A: ","Avai SC - Atletico Mineiro MG"]]]
How can I get the data from this object using php , for example i need to get the time and save it in variable
if you need the time
assuming you have $myArray
$myArray = Array ( [0] => [[["15:30"," ","Alemania","Germany"," Bundesliga: ","Bayer Leverkusen - SC Freiburg"]]]
[1] => [[["15:30"," ","Polonia","Poland"," Ekstraklasa: ","MKS Sandecja Nowy Sacz - Termalica Bruk-Bet Nieciecza"]]]
[2] => [[["15:30"," ","Rusia","Russia"," Premier League: ","FC Rubin Kazan - FC Ural Yekaterinburg"]]]
[3] => [[["16:00"," ","Albania","Albania"," Kategoria Superiore: ","KF Laci - Luftetari Gjirokaster"]]]
[4] => [[["16:00"," ","Brasil","Brazil"," Brasileir\u00e3o Serie A: ","Avai SC - Atletico Mineiro MG"]]] );
you could use
foreach ($myArray as $key => $value) {
$myTime[$key]= $value[0][0][0] ;
}
in $myTime = have an array with only the time
Being new to PHP and having looked at documentation and whatnot, I'm unable to find the answer to this question.
I want to take a $_POST input like:
Large Automated Structural Restoration 1 Hull Repair Unit Medium 50 m3
Experimental 10MN Microwarpdrive I 5 Propulsion Module Medium 50 m3
Warp Disruptor I 1 Warp Scrambler Medium 5 m3
Upgraded EM Ward Amplifier I 1 Shield Amplifier Medium 5 m3
Tracking Disruptor I 1 Tracking Disruptor Small Medium 5 m3
Into an array like:
[Experimental 10MN Microwarpdrive I] [5] [Propulsion Module] [] [Medium] [50] //Disregard m3
[Warp Disruptor I] [1] [Warp Scrambler] [] [Medium] [5]
...
[Tracking Disruptor I] [1] [Tracking Disruptor] [Small] [Medium] [5]
To where I could call a variable like $asset[0][name] so I can prepare an XML call out to an external resource.
The logic is escaping me or I'm not understanding something. Please help!
$aero=explode(PHP_EOL,trim($_POST['textarea'])); //separate each line
$asset=array(); //init the assets
foreach ($aero as $unit) { //loop each line
$detail=explode("\t",$unit); //split by tab
$name=$detail[0]; //assign the name to the first item in the arr
unset($detail[count($detail)-1]); //delete the last item ('m3' not needed)
unset($detail[0]); //delete the first item (we saved it as $name)
$asset[][$name]=$detail; //add an array item
}
Just for the fun, here's another solution using a regex 1-liner when you wouldn't have tabs:
$regex='/^([A-Za-z0-9 ]+) (\d+) ([A-Z][A-Za-z ]+?)(\ ()|\ (Small)\ )([A-Z][a-z]+) (\d+) m3$/m';
preg_match_all($regex,$textarea,$aero);
$asset=array();
foreach ($aero[1] as $no=>$unit) {
$asset[$unit]=array($aero[2][$no],
$aero[3][$no],
$aero[6][$no],
$aero[7][$no],
$aero[8][$no]);
}
Would probably need a small addition for this bit: (\ ()|\ (Small)\ ) something along the lines of (\ ()|\ (Small)\ |\ (Medium)\ |\ (Large)\ )
Regex output for the first and last lines from example before processing:
Array ( [0] => Array ( [0] => Large Automated Structural Restoration 1 Hull Repair Unit Medium 50 m3 [1] => Tracking Disruptor I 1 Tracking Disruptor Small Medium 5 m3 )
[1] => Array ( [0] => Large Automated Structural Restoration [1] => Tracking Disruptor I )
[2] => Array ( [0] => 1 [1] => 1 )
[3] => Array ( [0] => Hull Repair Unit [1] => Tracking Disruptor )
[4] => Array ( [0] => [1] => Small )
[5] => Array ( [0] => [1] => )
[6] => Array ( [0] => [1] => Small )
[7] => Array ( [0] => Medium [1] => Medium )
[8] => Array ( [0] => 50 [1] => 5 ) )
if you explode the string with a delimiter of a regex of >1 whitespace, then everything would be in an array that you could do what you want with.
$reg = '\s+';
$ar = explode($reg,$_POST['val']);
I'm trying to look up the artist BIO information with the LASTFM api but I'm having trouble.
I'm using PHP and a CURL request that's returning the result as XML.
If I use the url that gets sent by CURL and just load it normally in the browser it show's everything as desired. However, the result returned by CURL in the php script is missing certain properties of the XML.
For example: artist->bio->summary is there but with no content.
You can replicate what I'm doing ill copy the basic concepts here:
open this in you browser:
http://ws.audioscrobbler.com/2.0/artist/cher/info.xml
copy and paste this into a PHP file and open:
$url = 'http://ws.audioscrobbler.com/2.0/artist/cher/info.xml';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$retData = curl_exec($ch);
curl_close($ch);
echo '<pre>';
echo $retData;
echo '</pre>';
You'll see that the returned results are similar but with missing content in the curl request. I've also tried doing this a simplexml_load_file() but the same happens. What am I missing? Cheers for any help!
Try to replace
echo $retData;
with
echo htmlspecialchars($retData);
and you'll see that everything is there. You're printing raw XML in an HTML context, and some of the tags in the XML are interpreted as HTML tags.
The url is wrong but that could be a typo ;p. The reason its content is missing is the <![CDATA[ tag, strip it before parsing and you should be good to go.
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://ws.audioscrobbler.com/2.0/artist/cher/info.xml');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$retData = curl_exec($ch);
$retData = str_replace(array('<![CDATA[',']]>'),'',$retData);
$xml = simplexml_load_string($retData);
$lastFM = json_decode(json_encode($xml),TRUE);
print_r($lastFM);
/*Array
(
[name] => Cher
[mbid] => bfcc6d75-a6a5-4bc6-8282-47aec8531818
[url] => http://www.last.fm/music/Cher
[image] => Array
(
[0] => http://userserve-ak.last.fm/serve/34/63530405.png
[1] => http://userserve-ak.last.fm/serve/64/63530405.png
[2] => http://userserve-ak.last.fm/serve/126/63530405.png
[3] => http://userserve-ak.last.fm/serve/252/63530405.png
[4] => http://userserve-ak.last.fm/serve/500/63530405/Cher.png
)
[streamable] => 1
[stats] => Array
(
[listeners] => 768175
[playcount] => 7895613
)
[similar] => Array
(
[artist] => Array
(
[0] => Array
(
[name] => Sonny & Cher
[url] => http://www.last.fm/music/Sonny+&+Cher
[image] => Array
(
[0] => http://userserve-ak.last.fm/serve/34/71168880.png
[1] => http://userserve-ak.last.fm/serve/64/71168880.png
[2] => http://userserve-ak.last.fm/serve/126/71168880.png
[3] => http://userserve-ak.last.fm/serve/252/71168880.png
[4] => http://userserve-ak.last.fm/serve/500/71168880/Sonny++Cher.png
)
)
[1] => Array
(
[name] => Cyndi Lauper
[url] => http://www.last.fm/music/Cyndi+Lauper
[image] => Array
(
[0] => http://userserve-ak.last.fm/serve/34/76056286.png
[1] => http://userserve-ak.last.fm/serve/64/76056286.png
[2] => http://userserve-ak.last.fm/serve/126/76056286.png
[3] => http://userserve-ak.last.fm/serve/252/76056286.png
[4] => http://userserve-ak.last.fm/serve/_/76056286/Cyndi+Lauper++for+Uniqlo.png
)
)
[2] => Array
(
[name] => Madonna
[url] => http://www.last.fm/music/Madonna
[image] => Array
(
[0] => http://userserve-ak.last.fm/serve/34/78270650.png
[1] => http://userserve-ak.last.fm/serve/64/78270650.png
[2] => http://userserve-ak.last.fm/serve/126/78270650.png
[3] => http://userserve-ak.last.fm/serve/252/78270650.png
[4] => http://userserve-ak.last.fm/serve/_/78270650/Madonna+Shes+a+bad+girl.png
)
)
[3] => Array
(
[name] => Kylie Minogue
[url] => http://www.last.fm/music/Kylie+Minogue
[image] => Array
(
[0] => http://userserve-ak.last.fm/serve/34/78217522.png
[1] => http://userserve-ak.last.fm/serve/64/78217522.png
[2] => http://userserve-ak.last.fm/serve/126/78217522.png
[3] => http://userserve-ak.last.fm/serve/252/78217522.png
[4] => http://userserve-ak.last.fm/serve/500/78217522/Kylie+Minogue+KylieBestOf.png
)
)
[4] => Array
(
[name] => Tina Turner
[url] => http://www.last.fm/music/Tina+Turner
[image] => Array
(
[0] => http://userserve-ak.last.fm/serve/34/74998404.jpg
[1] => http://userserve-ak.last.fm/serve/64/74998404.jpg
[2] => http://userserve-ak.last.fm/serve/126/74998404.jpg
[3] => http://userserve-ak.last.fm/serve/252/74998404.jpg
[4] => http://userserve-ak.last.fm/serve/_/74998404/Tina+Turner+Queen+3.jpg
)
)
)
)
[tags] => Array
(
[tag] => Array
(
[0] => Array
(
[name] => pop
[url] => http://www.last.fm/tag/pop
)
[1] => Array
(
[name] => female vocalists
[url] => http://www.last.fm/tag/female%20vocalists
)
[2] => Array
(
[name] => 80s
[url] => http://www.last.fm/tag/80s
)
[3] => Array
(
[name] => dance
[url] => http://www.last.fm/tag/dance
)
[4] => Array
(
[name] => rock
[url] => http://www.last.fm/tag/rock
)
)
)
[bio] => Array
(
[published] => Tue, 1 May 2012 12:51:56 +0000
[summary] => Cher (born Cherilyn Sarkisian on May 20, 1946) is an American singer, actress, songwriter, author and entertainer. Among her many career accomplishments in music, television and film, she has won an Academy Award, a Grammy Award, an Emmy Award and three Golden Globe Awards among others. Referred to as the Goddess of Pop, Cher first rose to prominence in 1965 as one half of the pop/rock duo Sonny & Cher.
[content] => Cher (born Cherilyn Sarkisian on May 20, 1946) is an American singer, actress, songwriter, author and entertainer. Among her many career accomplishments in music, television and film, she has won an Academy Award, a Grammy Award, an Emmy Award and three Golden Globe Awards among others.
Referred to as the Goddess of Pop, Cher first rose to prominence in 1965 as one half of the pop/rock duo Sonny & Cher. She also established herself as a solo recording artist, releasing 25 albums, contributing to numerous compilations, and tallying 34 Billboard Top 40 entries over her career, both solo and with Sonny. These include eighteen Top 10 singles and five number one singles (four solo). Cher has had 16 top ten hits in the UK between 1965 and 2003, four of which reached number one (two solo, one with Sonny, one as part of a charity single).
In a career surpassing 40 years, Cher has been described as an enduring pop icon and one of the most popular female artists in music history. Since her debut in 1964, Cher has sold as a solo artist over 180 million records worldwide and an estimated 70 million singles and with duo Sonny and Cher over 80 million records becoming one of the biggest-selling artists of all time.
She became a television star in the 1970s and a film actress in the 1980s. In 1987, she won the Academy Award for Best Actress for her role in the romantic comedy Moonstruck.
During 2007, in the seventh volume of Chrome Hearts, Cher once again confirmed that she is working on her twenty-sixth studio album. No recordings have taken place as of yet, and no release date had been scheduled.
It is rumoured that Cher will collaborate with Lady Gaga in a song for her next album Born This Way. This album is expected to be released in Spring 2011.
On February 7, 2008 Cher, at 61, announced that she had reached a deal to perform 200 shows over three years live at the Colosseum at Caesar's Palace in Las Vegas. Her new show, entitled Cher at the Colosseum, debuted on May 6, 2008. The show reportedly includes 18 dancers, 4 aerialists, and multiple costumes designed by Bob Mackie. Choreography will be directed by Doriana Sanchez who also worked with Cher on her past three major tours. Her show will perform four nights a week for a month, and a second leg of the show will continue in August. Cher will share the stage on a rotating basis with contemporaries Bette Midler (whose The Showgirl Must Go On opened on February 20, 2008) and Elton John (whose The Red Piano which opened in 2004, will continues its run of about 50 shows a year).
Cher made her musical debut and first film role in a decade in , starring alongside Christina Aguilera, who also made her musical and film debut. The film was released in November 2010.
User-contributed text is available under the Creative Commons By-SA License and may also be available under the GNU FDL.
)
)
*/
i use imdb api
$homepage = file_get_contents('http://www.imdbapi.com/?i='.$imdbID);
$arr = json_decode($homepage);
In $arr i have all data about related movie.
Maguire [Year] => 1996 [Rated] => R [Released] => 13 Dec 1996 [Genre] => Comedy, Drama, Romance, Sport [Director] => Cameron Crowe [Writer] => Cameron Crowe [Actors] => Tom Cruise, Cuba Gooding Jr., Renée Zellweger, Kelly Preston [Plot] => When a sports agent has a moral epiphany and is fired for expressing it, he decides to put his new philosophy to the test as an independent with the only athlete who stays with him. [Poster] => http://ia.media-imdb.com/images/M/MV5BMTkxNjc2NjQwOF5BMl5BanBnXkFtZTcwMDE2NDU2MQ##._V1_SX320.jpg [Runtime] => 2 hrs 19 mins [Rating] => 7.2 [Votes] => 97329 [ID] => tt0116695 [Response] => True )
what i want is that reaching specified key's value.
Is there a function like that? For example , i will give the key=> Actors and get all actors?
:/ Like this?
$homepage = file_get_contents('http://www.imdbapi.com/?i='.$imdbID);
$arr = json_decode($homepage, true);
print($arr['Actors']);