Customizing unserialize output.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to implement the yahoo search api using php.
I prefer to use PHP serialized to get the result of the search
displayed.
Right now i get the output like:
Array
(
    [ResultSet] => Array
        (
            [type] => web
            [totalResultsAvailable] => 20800000
            [totalResultsReturned] => 20
            [firstResultPosition] => 1
            [moreSearch] =>
/WebSearchService/V1/webSearch?query=bangalore&appid=Jahangir&region=us
            [Result] => Array
                (
                    [0] => Array
                        (
                            [Title] => Explocity.com Bangalore. The
city as it happens
                            [Summary] => Offers an event schedule,
places to see, shopping, dining, and other information about Bangalore.
                            [Url] =>
http://www.explocity.com/bangalore.asp
                            [ClickUrl] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAtkDdmMwF;_ylu=X3oDMTB2cX...
                            [DisplayUrl] =>
www.explocity.com/bangalore.asp
                            [ModificationDate] => 1166860800
                            [MimeType] => text/html
                            [Cache] => Array
                                (
                                    [Url] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAuEDdmMwF;_ylu=X3oDMTBwOH...
                                    [Size] => 28482
                                )

                        )


                    [1] => Array
                        (
                            [Title] => Bangalore
                            [Summary] => Tourist guide around the city
of Bangalore including historical background, weather, dining,
entertainment, and accommodations.
                            [Url] => http://www.discoverbangalore.com/
                            [ClickUrl] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAukDdmMwF;_ylu=X3oDMTB2Zj...
                            [DisplayUrl] => www.discoverbangalore.com/
                            [ModificationDate] => 1166860800
                            [MimeType] => text/html
                            [Cache] => Array
                                (
                                    [Url] =>
http://uk.wrs.yahoo.com/_ylt=A0Je5ar3NI5FgPAAvEDdmMwF;_ylu=X3oDMTBwZG...
                                    [Size] => 25882
                                )


I am trying to format this using 2 foreach loop. One for Array second
for ResultSet and Third for individual Result.
Example of what im trying:

foreach($display as $disp) // Main "Array"
{$output['title']=$disp;
echo "$output";
foreach($disp as $key=>$value)
{$newobj=$key;
echo "<br>$newobj";
$newobj3=$Array["ResultSet"]["moreSearch"];
echo "<br>$newobj3";}}


But i am having a hard time getting the output that i want.
Can someone help me format the output got from unserialize() in the
same way as yahoo displays its result on its main page.


thanks in advance

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux