function UserAccountStatus() { $contents = '<GetAccountStatus xmlns="https://vesta.ecordia.com"><submission xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:ApiKey>' . $this->apiKey . '</a:ApiKey></submission></GetAccountStatus>'; $contents = $this->client->serializeEnvelope($contents); $endpoint = 'https://vesta.ecordia.com/IUserManagement/GetAccountStatus'; $results = $this->client->send($contents, $endpoint, 0, 180); $this->results = $results; $this->requestHasBeenExecuted = true; }
function GetAlternateKeywords($keyword) { $contents = ' <GetKeywordAlternates xmlns="https://vesta.ecordia.com"> <request xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:ApiKey>' . $this->apiKey . '</a:ApiKey> <a:SeedTerm>' . $keyword . '</a:SeedTerm> </request> </GetKeywordAlternates> '; $contents = $this->client->serializeEnvelope($contents); $endpoint = 'https://vesta.ecordia.com/IContentAnalysis/GetKeywordAlternates'; $results = $this->client->send($contents, $endpoint, 0, 180); $this->results = $results; $this->requestHasBeenExecuted = true; }
function GetAnalysis($title, $description, $content, $url) { $contents = ' <GetAnalysis xmlns="https://vesta.ecordia.com"> <request xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:ApiKey>' . $this->apiKey . '</a:ApiKey> <a:DocumentBody><![CDATA[' . $content . ']]></a:DocumentBody> <a:DocumentDescription><![CDATA[' . $description . ']]></a:DocumentDescription> <a:DocumentSampleUrl><![CDATA[' . $url . ']]></a:DocumentSampleUrl> <a:DocumentTitle><![CDATA[' . $title . ']]></a:DocumentTitle> </request> </GetAnalysis> '; $contents = $this->client->serializeEnvelope($contents); $endpoint = 'https://vesta.ecordia.com/IContentAnalysis/GetAnalysis'; $results = $this->client->send($contents, $endpoint, 0, 180); $this->results = $results; $this->requestHasBeenExecuted = true; }
function GetSearchEngineLinks($terms, $searchType, $url) { $termText = ''; foreach ($terms as $term) { $termText .= "<b:string><![CDATA[{$term}]]></b:string>"; } $contents = '<GetSearchEngineResults xmlns="https://vesta.ecordia.com"> <request xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:ApiKey>' . $this->apiKey . '</a:ApiKey> <a:SearchTerms xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays">' . $termText . '</a:SearchTerms> <a:SearchType>' . $searchType . '</a:SearchType> <a:SubjectUrl><![CDATA[' . $url . ']]></a:SubjectUrl> </request> </GetSearchEngineResults>'; $contents = $this->client->serializeEnvelope($contents); $endpoint = 'https://vesta.ecordia.com/IContentAnalysis/GetSearchEngineResults'; $results = $this->client->send($contents, $endpoint, 0, 180); $this->results = $results; $this->requestHasBeenExecuted = true; }
/** * Internal utility methods */ private function call($service, $method, $params) { ini_set('memory_limit', '1024M'); ini_set('max_execution_time', 1800); set_time_limit(0); $url = $this->wsdl_root . $service . '.asmx?wsdl'; $timeout = 3000; $cache = new nusoap_wsdlcache($this->cache_dir, $timeout); $wsdl = $cache->get($url); // Set the WSDL if (is_null($wsdl)) { $wsdl = new wsdl($url, NULL, NULL, NULL, NULL, 0, $timeout, NULL, TRUE); $error = $wsdl->getError(); $debug = $wsdl->getDebug(); $wsdl->clearDebug(); // Check for SOAP errors if (!empty($error)) { $this->errors[] = $error; if ($debug) { $this->errors[] = '<pre>' . print_r($debug, TRUE) . '</pre>'; } return FALSE; } $cache->put($wsdl); } // Send the SOAP request $params['securityPassword'] = $this->wsdl_keys[$service]; $client = new nusoap_client($wsdl, 'wsdl', FALSE, FALSE, FALSE, FALSE, 0, $timeout); $client->setDebugLevel(0); // 0 - 9, where 0 is off $client->useHTTPPersistentConnection(); if ($service == 'DataAccess' && $method == 'ExecuteStoredProcedure') { /* * See http://www.codingforums.com/archive/index.php/t-85260.html * and http://users.skynet.be/pascalbotte/rcx-ws-doc/nusoapadvanced.htm * for how to thwart the "got wsdl error: phpType is struct, but value is not an array" * error returned by nusoap when processing the response from $client->call() * * */ $request = $client->serializeEnvelope(vsprintf('<ExecuteStoredProcedure xmlns="http://ibridge.isgsolutions.com/%s/"> <securityPassword>%s</securityPassword> <name>%s</name> <parameters>%s</parameters> </ExecuteStoredProcedure>', array($service, $params['securityPassword'], $params['name'], $params['parameters']))); $response = $client->send($request, 'http://ibridge.isgsolutions.com/' . $service . '/' . $method, 0, $timeout); } else { $response = $client->call($method, $params); } $error = $client->getError(); $debug = $client->getDebug(); $client->clearDebug(); // Check for SOAP errors if (!empty($error)) { $this->errors[] = $error; if ($debug) { $this->errors[] = '<pre>' . print_r($debug, TRUE) . '</pre>'; } return FALSE; } // Process response $response = $response[$method . 'Result']; $data = NULL; if (strpos($response, '<') == 0) { // Some ISGweb methods return strings instead of XML libxml_use_internal_errors(TRUE); $response = preg_replace('/(<\\?xml[^?]+?)utf-16/i', '$1utf-8', $response); // Change encoding string to UTF8 $response = utf8_encode($response); $response = $this->strip_invalid_xml($response); $obj = simplexml_load_string($response); $data = $response; $error = libxml_get_errors(); // Check for XML parsing errors if (!empty($error)) { foreach ($error as $e) { $this->errors[] = $e; } libxml_clear_errors(); return FALSE; } $data = $this->object_to_array($obj); // Check for ISGweb errors (e.g. invalid data input, failure of service, etc.) if (array_key_exists('Errors', $data)) { $error = $data['Errors']; foreach ($error as $e) { $this->errors[] = $e['@attributes']['Description']; } return FALSE; } } else { $data = $response; } return $data; }