I am trying to write a simple webservice and utilize it in my windows phone.
I’ve written a php script as follow:
$PromotionCount=$_GET['count'];
$promotions = PromotionsAPI::RetrievePRomotions($PromotionCount);
while($row=mysql_fetch_array($promotions))
{
$rows[] = array ('CompanyName' => $row[0] ,
'CompanyPromotion' => $row[1],
'PromotionRating' => $row[2] ,
'PromotionPicPath' => $row[3],
'PromotionTitle' => $row[4],
'PromotionlikesCount' => $row[5],
'PromotionCommentsCount' => $row[6]);
}
echo json_encode($rows);
Now I will be calling this with the following link.
http://localhost/php/promotionWork/API%20and%20Libraries/PromotionsAPI.php?count=3
From my windows phone I want to get the encoded json data that I am echoing.
I don’t know that if it’s possible to do a query in such a way or is it necessary to use SOAP etc.
So can you guys please point me to the right direction by telling me the right and easy way to accomplish this and if I am right then how do I be able to get the json data that i am echoing in my WINDOWS PHONE App
The code for PHP looks fine (at least I wouldn’t have done it somehow else).
For your client, you might want to use JSON.NET.