alvast sorry ik ben vrij nieuw met php :-) Ik ben in php bezig om een webservice aan te roepen. Dat gaat prima alleen in de code moet ik een variable uit mysql halen zodat die meegestuurd kan worden naar de webservice. De Variable is
$licensekey = 'fc64183a3ad8e9a1e4b80538686a55b4';
Omdat ik magento gebruik zou ik zoiets moeten gebruiken
$licensekey = Mage::getStoreConfig('SDOCP_options/module/enable_serial');
maar dan krijg ik
Fatal error: Class 'Mage' not found in
Dit is de complete code
<?php
/**
* Checks the license with the given mag-extension service
*
* @param string $key
* @param string|null $url Defaults to the current host if not provided
* @return bool
*/
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
function checkLicense($key, $url = null) {
static $wsdl = 'x';
if ($url == null) {
$url = $_SERVER['HTTP_HOST'];
}
$clientOptions = array(
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
//'trace'=> 1, // when the service b0rks, enable the tracing, for easier debugging
);
$client = new SoapClient($wsdl, $clientOptions);
$params = array(
'LicenseKey' => $key,
'URL' => $url,
);
$checkLicenseResponse = $client->CheckLicense($params);
return !empty($checkLicenseResponse->IsValid) && $checkLicenseResponse->IsValid === true;
}
$licensekey = Mage::getStoreConfig('SDOCP_options/module/enable_serial');
$url = '';
var_dump(checkLicense($licensekey, $url));
try {
$checkLicenseResponse = $client->CheckLicense($params);
$result = !empty($checkLicenseResponse->IsValid) && $checkLicenseResponse->IsValid === true;
} catch (SoapFault $e) {
// or don't catch the fault so it can rethrow the error ?
$result = false;
}
return $result;