Dooley28 Posted February 15, 2008 Share Posted February 15, 2008 Hi all, I'm developing a app that needs to calls MSNs live search api using nusoap. However on my laptop the calls don't work but when I upload the php script to my server it's works perfectly. Im using ubuntu, do I need to open ports or modify any php settings. Thanks in advance for any help Dooley Quote Link to comment https://forums.phpfreaks.com/topic/91305-soap-calls-dont-work/ Share on other sites More sharing options...
rhodesa Posted February 15, 2008 Share Posted February 15, 2008 Elaborate on "on my laptop the calls don't work". Are you getting a specific error? Does it say the functions don't exist? Does the module show as loaded in phpinfo()? Do you have some sample code you are using right now? Quote Link to comment https://forums.phpfreaks.com/topic/91305-soap-calls-dont-work/#findComment-467932 Share on other sites More sharing options...
Dooley28 Posted February 15, 2008 Author Share Posted February 15, 2008 Hi sorry, Was in a rush didn't elaborate. Apologies.. Here's the code im trying to implement <?php /** * This set of functions queries MSN Search API. * * This is a single php page and set of functions that, when given the right * data will return a set of formatted MSN search results. Requires NuSOAP, * located at http://sourceforge.net/projects/nusoap/. * Stick this file into a folder in your server along with NuSOAP * library and point your browser there for action. Don't forget to get * an MSN Application ID (see http://search.msn.com/developer) * * Read the related blog post here: * http://www.fiftyfoureleven.com/weblog/web-development/programming-and-scripts/apis/msn-search-api * * @author: Mike Papageorge, http://www.fiftyfoureleven.com/contact * @lastUpDate: 14/11/2005 * @license: http://creativecommons.org/licenses/by/2.5/ * @location: http://www.fiftyfoureleven.com/site/code/msn-search-api-sample.txt */ error_reporting(E_ALL); // Variables for the search. You need to edit these to use this: $id = 'my developer key'; $site = ''; $numresults = 30; $baseurl = 'http://soap.search.msn.com/webservices.asmx'; // MSN API URI $form = ' <form action="'.$_SERVER['PHP_SELF'].'" method="get"> <label for="p">Search Terms</label> <input name="p" id="p" type="text" /> <input type="submit" value="search" /> </form> '; /** * A little 'controller' to make this sample page work: * */ $xhtml = ''; if(isset($_GET['p']) && $_GET['p'] != '') { $data = getResultArray($id, $site, $baseurl, $numresults); $xhtml = $form.formatMSNResultset($data, $numresults); } else { // If an empty search was given: $xhtml = (isset($_GET['p']) && $_GET['p'] == '') ? '<p>Please enter a search term</p>':''; // Show the form: $xhtml .= $form; } echo $xhtml; // // // Here be functions.... // // /** * Build an array with the parameters we want to use. * */ function setParams($id, $site, $numresults) { $params = array( // Details for all of these can be found in the developer's kit, // in the help file. 'AppID' => $id, 'Query' => "My Query", 'CultureInfo' => 'en-US', 'SafeSearch' => 'Off', 'Requests' => array ( 'SourceRequest' => array ( 'Source' => 'Web', 'Offset' => 0, 'Count' => $numresults, 'ResultFields' => 'All' ) ) ); return $params; } /** * This function passes our data to NuSOAP, and * returns the search results: */ function getResultArray($id, $site, $baseurl, $numresults) { // Get the parameters: $params = setParams($id, $site, $numresults); // Include the library: include_once("nusoap.php"); // Create a instance of the SOAP client object $soapclient = new soapclient($baseurl); $data = $soapclient->call("Search", array("Request"=>$params)); return $data; } /** * This function formats our MSN specific array: * */ function formatMSNResultset($data, $numresults) { // If no results were found: if($data['Responses']['SourceResponse']['Total'] == '0') { $results = '<p>There were 0 results found with MSN search. Please try again by typing your search terms into the search box, and then click search.</p>'; return $results; } // Now down to business: $tmp = ''; foreach($data['Responses']['SourceResponse']['Results']['Result'] as $key => $value) { $tmp .= '<dt><a href="'.$data['Responses']['SourceResponse']['Results']['Result'][$key]['Url'].'">'.$data['Responses']['SourceResponse']['Results']['Result'][$key]['Title'].'</a></dt> '; $r = htmlentities($data['Responses']['SourceResponse']['Results']['Result'][$key]['Description']); $tmp .= '<dd>'.$r.'</dd> '; } $results = '<h1>Viewing '.$numresults.' of '.$data['Responses']['SourceResponse']['Total'].' results found by MSN search.</h1> <dl> '.$tmp.' </dl>'; return $results; } ?> Blantently stolen from the internet but this is just a text, I do need to be able to query a search engine and heres the error I get. Warning: SoapClient::SoapClient(http://soap.search.msn.com/webservices.asmx) [function.SoapClient-SoapClient]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/page/survey/getdefinitions.php on line 96 Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://soap.search.msn.com/webservices.asmx" in /var/www/page/survey/getdefinitions.php on line 96 Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://soap.search.msn.com/webservices.asmx' in /var/www/page/survey/getdefinitions.php:96 Stack trace: #0 /var/www/page/survey/getdefinitions.php(96): SoapClient->SoapClient('http://soap.sea...') #1 /var/www/page/survey/getdefinitions.php(43): getResultArray('2725F7DF7AE0E9A...', '', 'http://soap.sea...', 30) #2 {main} thrown in /var/www/page/survey/getdefinitions.php on line 96 So effectively it doesn't see the mircosoft live, server. And as I said when I bang the code up to a server it works perfectly. That why I assume it's an issue with php connection to the web. As you can see I don't need the soap module installed, i'm using nusoap. Thanks again for any light you can shed on the subject. Quote Link to comment https://forums.phpfreaks.com/topic/91305-soap-calls-dont-work/#findComment-468064 Share on other sites More sharing options...
Dooley28 Posted February 16, 2008 Author Share Posted February 16, 2008 Can anyone help??? Quote Link to comment https://forums.phpfreaks.com/topic/91305-soap-calls-dont-work/#findComment-468352 Share on other sites More sharing options...
Dooley28 Posted February 20, 2008 Author Share Posted February 20, 2008 Has anyone had this problem at all before? Quote Link to comment https://forums.phpfreaks.com/topic/91305-soap-calls-dont-work/#findComment-471910 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.