PDA

View Full Version : Uncaught exception 'com_exception' with message 'Failed to create COM object'



wajahat
11-21-2011, 12:46 AM
I am looking forward to use API for automatically demo account creation through my webpage.
http://www.heliosco.com/site/start_trading
Currently, customers have to submit 2 times, once in the software and secondly on the web.

I have used the following code and got following fatal error and exception:

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `VertexFXOpenDemo.CVertexFXOpenDemo' in OpenDemoCode.php on line 23

com_exception: Failed to create COM object `VertexFXOpenDemo.CVertexFXOpenDemo': Invalid syntax in OpenDemoCode.php on line 23


<?php
set_time_limit(0);

$Name=$_POST['name'];
$Country=$_POST['country'];
$Deposit=(double)$_POST['deposit'];
$Address=$_POST['address'];
$Email=$_POST['email'];
$Phone=$_POST['phone'];

$ServerIP="localhost";//Please provide your VertexFX ServerIP here,,,
$ServerPort=4401;//Please provide your VertexFX Server port here,,,

$Password=$_POST['password'];

$obj=new COM("VertexFXOpenDemo.CVertexFXOpenDemo") or die("Unable to include the dll");
$obj->OpenDemo($ServerIP, $ServerPort, $Address, $Email, $Name, $Phone, $Country, $Deposit, $Password);

if ($obj == null)
echo "obj Not Created";

while(!$obj->ResultReceived)
{
com_message_pump(10);
}

switch($obj->DemoResult)
{
case 1:
echo "Username = $obj->Uname\n";
break;
CASE 3:
echo "The account is not generated; same IP";
break;
default:
echo "The account is not generated";
}
?>

Any Help will be appreciated!

Yousef-HS
11-21-2011, 09:08 AM
Hello,

In your posted code, and from the first look there is a piece of code which is:


$ServerIP="localhost";//Please provide your VertexFX ServerIP here,,,

Please change the localhost to your server IP. Save the PHP file and re-upload it and allow overwrite. The localhost means your webserver which in this case wrong because the server of where users are registering for demo client is different that your web server. Update us of any further notes after changing the value stated above.

Make sure you have downloaded the PHP API sample from here


http://www.hybrid-solutions.com/forum/showthread.php?3113-VertexFX-Client-API-Samples

wajahat
11-21-2011, 08:37 PM
Firstly, I have tried same code with my own server ip and port rather than localhost.

Secondly, I was compiling on local wamp server, now i am compiling online and getting the error;

"Fatal error: Class 'COM' not found in /data/16/2/104/61/2593713/user/2844419/htdocs/api/OpenDemoCode.php on line 23"

so, error occur on line 23 i.e. COM object in not being created.
Is there any COM class which i have to include first or some PHP/Apache Module, which is not being loaded?

Yousef-HS
11-22-2011, 12:07 PM
Hello Wajahat,

We could replicate the case at our servers, i have informed the concerned developer about this case, he will give us an update as soon as possible.

Thank you.

Yousef-HS
11-29-2011, 10:14 AM
Dear Wajaht,

Please note that we support Windows enviroemtns only, if you have a windows server please do the following:

1. Download and install Xampp by visiting the following link: http://www.apachefriends.org/en/xampp.html
2. Download the the following sample http://www.hybrid-solutions.com/OpenDemoAccountPhpSample.zip
3. After extracting the zip file, take what's inside the folder named VertexFXOpenDemo dll to system32 and register the dll files.
4. Insert the php files to a directory and run it then try to register for a demo account.

If your website is on a linux web server, you may use an Iframe and insert the iframe in your webpage of which users can use to create a demo account.

Let us know how it goes :)