A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearPHP5 and Microsoft Live Search 2.0 - page 1
User InfoPosts
PHP5 and Microsoft Live Search 2.0#1
I'm trying to use Live Search 2.0 but even a simple example doesn't seem to work. Microsoft only has example code for 1.1 and they're not giving out AppIDs for that version.

Here's what I'm trying with:

$server = new SoapClient('http://soap.search.msn.com/webservices.asmx?wsdl');

class Search {
public $Request;

class SearchRequest {
public $AppID;
public $Query;
public $CultureInfo;
public $SafeSearch;
public $Flags;
public $Location;
public $Requests;

class SourceRequest {
public $Source;
public $Offset;
public $Count;
public $FileType;
public $SortBy;
public $ResultFields;
public $SearchTagFilters;

$searchRequest = new SourceRequest();
$searchRequest->Source = 'Web';
$searchRequest->Offset = 0;
$searchRequest->Count = 5;
$searchRequest->ResultFields = 'All SearchTagsArray';

$request = new SearchRequest();
$request->AppID = '...';
$request->Query = 'Bill Gates';
$request->CultureInfo = 'en-US';
$request->SafeSearch = 'Off';
$request->Flags = '';
$request->Requests = array($searchRequest);

$search = new Search();
$search->Request = $request;


AppID is correctly specified in the code: I just erased it from here. I'm getting the following error:

Array ( [0] => SearchResponse Search(Search $parameters) )
Fatal error: Uncaught SoapFault exception: [soapenv:Client] Client Error in /Users/thardas/Sites/vt9/widgets/ms_livesearch.php:41
Stack trace:
#0 [internal function]: SoapClient->__call('Search', Array)
#1 /Users/thardas/Sites/vt9/widgets/ms_livesearch.php(41): SoapClient->Search(Object(SearchRequest))
#2 /Users/thardas/Sites/vt9/index.php(23): include('/Users/thardas/...')
#3 {main} thrown in /Users/thardas/Sites/vt9/widgets/ms_livesearch.php on line 41

posted date: 2008-12-17 07:43:00

Re: PHP5 and Microsoft Live Search 2.0#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-17 07:43:01

Re: PHP5 and Microsoft Live Search 2.0#3
You could begin by using the proper soap api url for 2.0.It's now"http://api.search.live.net/search.wsdl?AppID=YourAppId" taken from (http://msdn.microsoft.com/en-us/library/dd250965.aspx )You can also use the new JSON api with php.$appid = 'Your app id';$searchitem = 'PHP Manual'; $request = 'http://api.search.live.net/json.aspx?Appid=' . $appid . '&sources=web&query=' . urlencode( $searchitem); $response = file_get_contents($request); $jsonobj = json_decode($response); foreach($jsonobj->SearchResponse->Web->Results as $value) { //$value->Url //$value->Title //$value->Description }And finally theres a xml api you can look up at the msdn link as well and it can be fetched essentially the same way as the json you just need to decode it differently.

posted date: 2008-12-21 18:23:00

Re: PHP5 and Microsoft Live Search 2.0#4
The sample code for API 2.0 is on MSDN but we do not have the complete PHP code sample out yet.A first code sample (very similar to the one in the answer you already got) in included in the blog post on the Live Search Developer BlogYou may be aware that there are currently some issues with SOAP in PHP 5.2.6 - the Live Search service seems to be affected by it in both 1.1 and 2.0. The simplest workaround is to use another interface (JSON or XML)

posted date: 2009-01-05 21:15:00

select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.