how to access dll (created with VB) via COM with codeigneter, in php using function COM (Component Object Model) what about codeigniter?
<?php $perhitungan = new COM("Jocki.Perhitungan"); $hasil = $perhitungan->HitungJumlah(11,22); print "Hasil dari method di COM DLL adalah $hasil"; ?>
Related
Trying to use the Microsoft's .NET classes from System.Security.Cryptography.X509Certificates located in System assembly raises the following error:
$certificate2 = new DOTNET('System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', 'System.Security.Cryptography.X509Certificates.X509Certificate2');
com_exception: Failed to instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such interface supported
in ...\test.php on line 2
Whereas the following calls do work and return DOTCOM instances.
$certificate = new DOTNET('mscorlib', 'System.Security.Cryptography.X509Certificates.X509Certificate');
$form = new DOTNET('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', 'System.Windows.Forms.Form');
Is there something special to System.dll or its classes contained in System.Security.Cryptography.X509Certificates?
Why could this file or classes not be usable?
digging deeper
The Exception origins to a failed method call in php_dotnet extension source code, line 250. But this is too low level for me. The call is:
hr = IUnknown_QueryInterface(V_UNKNOWN(&unwrapped), &IID_IDispatch, &V_DISPATCH(&obj->v));
side notes
PHP version is 5.5.5
this happens on a Windows 7 and Windows Server 2008 R2 box
the assembly seems to accessed correctly, but classes can not be found
selected .NET Framework Version is 2.0.0.0 (<=3.5), because PHP DOTNET does not work with Version >= 4
Cryptography classes from mscorlib do not suffice, because of limited functionality
Try this.It's working for me
<?php
$stack = new DOTNET("mscorlib", "System.Collections.Stack");
$stack->Push(".Net");
$stack->Push("Hello ");
echo $stack->Pop() . $stack->Pop();
?>
The link for the doc, Click here
I'm relatively new to PHP, and totally new to VB.NET / Web Services / SOAP / XML, and i'm having trouble to make my PHP communicate with the VB.NET web service.
This is my PHP script:
<?php
$client = new SoapClient("http://10.0.0.2/wsteste/Service1.asmx?wsdl");
$param = array("usuario" => "name", "senha" => "test");
$response = $client->__soapCall("HelloWorld", $param);
print_r($response);
?>
And here is the VB.NET asmx.
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld(ByVal usuario As String, ByVal senha As String) As String
Return usuario & " - " & senha
End Function
End Class
And here is what printed on the browser:
stdClass Object ( [HelloWorldResult] => - )
It was supposed to return name - test, wasn't it?
I think that the PHP SOAP Client is passing the parameters without the names. So usuario nor senha means nothing to the HelloWorld method.
I would try something like
$client->HelloWorld(array("usuario"=>"name", "senha"=>"test"));
Haven tested though.
EDIT
From this question Call asp.net web service from PHP with multiple parameters
Pass your params like this
$params->usuario = 'name';
$params->senha = 'test';
$client->HelloWorld($params);
I use wamp server and Propel.I have written my service using Propel but when I want to connect the data returned from the service Flex cannot recognize the return type.
This is the php code that I wrote
<?php
// Include the main Propel script
require_once 'C:/wamp/propel/runtime/lib/Propel.php';
// Initialize Propel with the runtime configuration
Propel::init("C:/wamp/www/school/build/conf/school-conf.php");
// Add the generated 'classes' directory to the include path
set_include_path("C:/wamp/www/school/build/classes" . PATH_SEPARATOR . get_include_path());
class TeacherService {
function getTeachers()
{
$allTeachers=TeacherQuery::create()->find();
$teachers=array();
foreach($allTeachers as $teacher1)
{
array_push($teachers, $teacher1);
}
return $teachers;
}
}
?>
I wanto to display the information of teacers in a datagrid yet when I choose to auto-detect the return type it gives the error
'teacher' cannot be set to the data type "StdClass" because it has no properties.
How can I let flex know the properties of teacher rows returned by propel?
#www.Flextras.com
Propel is a PHP ORM framework.
If you want serialization to work on your php class you would have to have something like this
var $_explicitType = "path.to.classes.Teacher";
and on your Flex side VO's you would have to have something like this.
[Bindable]
[RemoteClass(alias="path.to.classes.Teacher")]
This is assuming you are using AMF. Also in your AMF endpoint you have to specify the mapping, so for example I would have something like this in my endpoint file.
$server->setClassMap('path.to.classes.Teacher' , 'path\to\classes\Teacher');
This lets your endpoint know that when it sees a class with the matching descriptor, which class on the PHP side it should be deserialized to.
i am working on AMFPHP and i had this problem
-> i am using XAMPP server with AMFPHP gate way for flex and this is working well for returning values from PHP
->the problem is how can i get the object in php which i passed to the pap class using flex code is here:-
connection.objectEncoding = ObjectEncoding.AMF3;
connection.connect("http://localhost/flashservices/gateway.php");
var obj:Employ = new Employ(inputs.ename.text,inputs.occu.text,inputs.adder.text,inputs.ph.text );
var responder = new Responder(recvdata,recverror);
connection.call("Employ.employrecord.employdata.insertrecord",responder,obj);
the obj is a employ class object and i want to get it in php class but how "need help"
thanx in advance
AMFPHP will handle the heavy lifting of converting the Flash/Flex data structures into PHP equivalents. At most you should just define a service handler and provide the appropriate arguments for the method so AMF can pass the client-side data to the PHP handler.
There's a decent example of both sides of the process here.
I am using following PHP code to connect to MS Access database:
$odb_conn = new COM("ADODB.Connection");
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". $db_path.";";
$odb_conn->open($connstr);
How can I retrieve database catalog/metadata from the mdb file?
FOUND THE SOLUTION
$rs_meta = $odb_conn->OpenSchema(20, array(Null, Null, Null, "TABLE"));
You will find information on ADO here :
http://msdn.microsoft.com/en-us/library/ms675532(VS.85).aspx
http://www.w3schools.com/ado/default.asp
The connection object has an OpenSchema method to get database schema information.
I don't know how to use MS Acces DB with PHP and how your new COM() object works, but I think it's better to use an OleDB connection instead an ADO object : http://msdn.microsoft.com/en-us/library/ms722784(VS.85).aspx
The MSysObjects table can be used to query metadata in Access:
SELECT NAME
FROM MSysObjects
WHERE Type In (1,4,6) AND Left([Name],4)<>"MSYS"