I'm trying to connect to a dll that was supplied to me, I don't have the ability to edit it.
Is the "Invalid syntax" error refering to a method within the dll or something with the php code?
try {
$testConnection = new COM("SomebodySpecial.DLL");
} catch (com_exception $e) {
echo "";
print_r( array( 'errorCode' => $e->getCode(),
'errorMessage' => $e->getMessage(),
'errorFile' => $e->getFile(),
'errorLine' => $e->getLine()));
echo "";
}
[errorCode] => -2147221020
[errorMessage] => Failed to create COM object `SomebodySpecial.DLL': Invalid syntax
[errorFile] => D:\Inetpub\wwwroot-dev\test.php
[errorLine] => 9
As the error message indicates, you provided an invalid parameter to the COM constructor.
The parameter is a COM ID, not a DLL filename.
Related
im using php 5.6 the thing is that im trying to catch php_network_getaddresses exception, but it gives me a fatal error.
Im trying to shut error_reporting(0) but it only reloads the page
I tried to to this too
error_reporting(0);
try {
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
$opts = array(
'http' => array(
'header' => "apikey: TokenApi $token",
)
);
$context = stream_context_create($opts);
$client = new \SoapClient($wsdl
, [
'stream_context' => $context,
'exception' => 0,
'trace' => 1
]);
}
catch (SoapFault $e) {
//echo $e->faultstring.'<br>asdasd';
trigger_error($e->getMessage());
if (strpos($e->faultstring, 'failed to load external entity')) {
$fecha_hora = "sin conexion";
return $fecha_hora;
//echo "The string 'lazy' was found in the string";
}
}
im not using xdebug and soap is enabled on php.ini
How can i catch this Fatal error to prevent the script die?
Im using cakephp 2.3 too, but i think this is not a problem from the framework.
I am trying to create an ad creative but getting an invalid parameter error. The exception even does not specify which parameter is wrong.
try {
$link_data = new AdCreativeLinkData();
$link_data->setData(array(
AdCreativeLinkDataFields::MESSAGE => 'try it out',
AdCreativeLinkDataFields::LINK => 'http://www.google.com',
AdCreativeLinkDataFields::IMAGE_HASH => '704e55dbf724243acfb8457a4f68a92a',
));
$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
AdCreativeObjectStorySpecFields::LINK_DATA => $link_data,
));
$creative = new AdCreative(null, 'act_576834712392068');
$creative->setData(array(
AdCreativeFields::NAME => 'Sample Creative Suite CRM',
AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));
$creative->create();
}
catch (Exception $e) {
echo 'Caught exception: ', $e, "\n";
}
Caught exception: exception
'FacebookAds\Http\Exception\AuthorizationException' with message
'Invalid parameter'
It seems you have not added the Page where the creative has to be posted. I think adding AdCreativeObjectStorySpecFields::PAGE_ID => 'your published page id here' in object_story_spec array will resolve your problem.
Don't forget to set your app's status to active from development. It was the reason of the same failure. You can check your error in more detail with
catch (Exception $e) {
var_dump($e)
}
I am doing a PHP SOAP Request as follows (my code, location removed as I'm not allow to publish)
try {
$location = "http://myUrltoWSDLhere";
$client = new SoapClient($location,
array(
'soap_version' => SOAP_1_1,
'login' => 'myuser',
'password' => 'mypass'
));
$params = array(array('BUKRS'=> 1));
$x = $client->ZIbFtiWsCredPosToWeb( $params );
print_r($x);
} catch (Exception $e) {
echo $e->getMessage();
}
I've been trying countless combinations how to pass the params to my method and I am doing a print_r($x) and gives me the below output.
stdClass Object ( [EBkpf] => stdClass Object ( ) [EMsgnr] => 6 [EMsgtxt] => BUKRS is missing [EMsgtyp] => E [ESstMon] => 00000000000000000000 )
Important: SoapClient getTypes returns the following for this method and the IBukrs is the field I am trying to pass data to. In SAP the Company Code is "BUKRS" so I had tried BUKRS and IBukrs and also Bukrs.
Any help would be greatly appreciated!!
[43] => struct ZIbFtiWsCredPosToWeb {
int IAnz;
char1 IAp;
char4 IBukrs;
ZibSstGjahr IGjahr;
ZibSstCredTt IKreditor;
char1 IOp;
numeric20 ISstMon;
}
WSDL Content: http://pastebin.com/fU5PhD9B
I'm trying to call a function from this webservice:
http://www.zulutrade.com/WebServices/Performance.asmx?WSDL
I'm sending all the requested params but I'm getting this error: Value cannot be null. Parameter name: source
I think it's a server issue, but maybe I need to change something in my code:
$client = new SoapClient('http://www.zulutrade.com/WebServices/Performance.asmx?WSDL',
array('location' => "http://www.zulutrade.com/WebServices/Performance.asmx",
'trace'=>1,
"cache_wsdl" => 0));
$params = array
(
'providerId' => 109206,
'fromDateStr' => "1985-12-19",
'toDateStr' => "2013-05-06",
'validTrades' => true,
'lotSize' => "Mini",
'start' => 0,
'length' => 20,
'sortBy' => "buy",
'sortAscending' => true
);
try
{
$result = $client->GetProviderTrades($params);
}
catch (SoapFault $fault)
{
print_r($fault);
}
Any ideas?
thanks
I tried with nusoap class and I get this error
HTTP Error: Couldn't open socket connection to server http://www.zulutrade.com:81/WebServices/Performance.asmx, Error (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
So maybe it's a bug on their part
You set all vars except one. ArrayOfInt currencyIds; is not set.
struct GetProviderTrades {
int providerId;
ArrayOfInt currencyIds;
string fromDateStr;
string toDateStr;
boolean validTrades;
LotSize lotSize;
int start;
int length;
string sortBy;
boolean sortAscending;
}
Using the Facebook REST API PHP client library, it seems wise to wrap calls in try{} thus:
require('facebook.php');
$fb = new Facebook($fbApiKey, $fbSecret);
try {
$result = $fb->api_client->some_api_method(...);
} catch (FacebookRestClientException $e) {
// now what?
}
But I'm not sure what to do with the exception, e.g. to find out what went wrong or to write a sensible message to the error log. Is there documentation for these exceptions somewhere?
After examining the code and some example exceptions, I think $e is an object looking something like this:
(
[message:protected] => An error message string
[string:Exception:private] => Don't know
[code:protected] => A numerical error code
[file:protected] => File here the exception was thrown
[line:protected] => Line where the exception was thrown
[trace:Exception:private] => A PHP debug_backtrace() result
[previous:Exception:private] => Don't know
)