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
[totalResultsAva ilable] =20800000
[totalResultsRet urned] =20
[firstResultPosi tion] =1
[moreSearch] =>
/WebSearchServic e/V1/webSearch?query =bangalore&appi d=Jahangir®i on=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.c om/bangalore.asp
[ClickUrl] =>
http://uk.wrs.yahoo.co m/_ylt=A0Je5ar3NI 5FgPAAtkDdmMwF; _ylu=X3oDMTB2cX VjNTM5BGNvbG8Dd wRsA1dTMQRwb3MD MQRzZWMDc3IEdnR pZAM-/SIG=11q4llbq3/EXP=1167033975/**http%3a//www.explocity.c om/bangalore.asp
[DisplayUrl] =>
www.explocity.c om/bangalore.asp
[ModificationDat e] =1166860800
[MimeType] =text/html
[Cache] =Array
(
[url] =>
http://uk.wrs.yahoo.co m/_ylt=A0Je5ar3NI 5FgPAAuEDdmMwF; _ylu=X3oDMTBwOH A5a2tvBGNvbG8Dd wRwb3MDMQRzZWMD c3IEdnRpZAM-/SIG=16i81upi9/EXP=1167033975/**http%3a//66.218.69.11/search/cache%3fei=UTF-8%26appid=Jahan gir%26query=ban galore%26output =php%26results= 20%26u=www.expl ocity.com/bangalore.asp%2 6w=bangalore%26 d=B-hzWEVuOAIw%26ic p=1%26.intl=us
[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.discoverban galore.com/
[ClickUrl] =>
http://uk.wrs.yahoo.co m/_ylt=A0Je5ar3NI 5FgPAAukDdmMwF; _ylu=X3oDMTB2Zj Q4dDExBGNvbG8Dd wRsA1dTMQRwb3MD MgRzZWMDc3IEdnR pZAM-/SIG=11ldrk2pv/EXP=1167033975/**http%3a//www.discoverban galore.com/
[DisplayUrl] =www.discoverba ngalore.com/
[ModificationDat e] =1166860800
[MimeType] =text/html
[Cache] =Array
(
[url] =>
http://uk.wrs.yahoo.co m/_ylt=A0Je5ar3NI 5FgPAAvEDdmMwF; _ylu=X3oDMTBwZG 5hOWwzBGNvbG8Dd wRwb3MDMgRzZWMD c3IEdnRpZAM-/SIG=16d2b45uj/EXP=1167033975/**http%3a//66.218.69.11/search/cache%3fei=UTF-8%26appid=Jahan gir%26query=ban galore%26output =php%26results= 20%26u=www.disc overbangalore.c om/%26w=bangalore% 26d=BCcdDEVuN_8 b%26icp=1%26.in tl=us
[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($displa y as $disp)
{
$output['title']=$disp;
echo "$output";
foreach($disp as $disp2)
{
$newobj=$disp2;
echo "<br>$newob j";
foreach($disp2 as $key=>$value)
{
//$newobj2=$value ; // displays [moresearch]
$newobj3=$value[2];
echo "<br>$newob j3";
}}}
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