PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hello,
I am trying to use a php interface to call an executable compiled in C++.
I first succeeded in using the executable’s functions and store my results in text file.
Now I am trying to use only the memory models instead of files to manipulate my actions and results with my classes, but I don’t now how to figure out with. Any help would be welcome:
<?
//&op, &ent1, &ent2 are my variables putted in text zone in an html page
$op = $_POST['ComponantName'];
$ent1=$_POST['Diametre'];
$ent2=$_POST['Long'];
$handle = popen('fonction','w');
$contenu = "$op $ent1 $ent2";
//Fonction utilisé pour l'ecriture du flux
fwrite($handle, $contenu);
//Fonction utilisé pour la lecture du flux
echo "L'écriture de $contenu dans le fichier a réussi <br>";
pclose($handle);
?>
class Componant
{
int Diametre;
int Long;
public:
Componant();
virtual ~Componant();
};
The constructor:
Componant::Componant(int D, int L)
{
Diametre = D;
Long= L;
}
I use a function to create an instance of my class with the desired values :
void AddComponant(char name, int D, int L)
{
new Componant MyComponant = Componant(name,D,L);
}
<?php
<?
//&op, &ent1, &ent2 are my variables putted in text zone in an html page
$op = $_POSTї'ComponantName'];
$ent1=$_POSTї'Diametre'];
$ent2=$_POSTї'Long'];
$handle = popen('fonction','w');
$contenu = "$op $ent1 $ent2";
//Fonction utilisé pour l'ecriture du flux
fwrite($handle, $contenu);
//Fonction utilisé pour la lecture du flux
echo "L'écriture de $contenu dans le fichier a réussi <br>";
pclose($handle);
?>
The C++ Classe :
class Componant
{
int Diametre;
int Long;
public:
Componant();
virtual ~Componant();
};
The constructor:
Componant::Componant(int D, int L)
{
Diametre = D;
Long= L;
}
I use a function to create an instance of my class with the desired values :
void AddComponant(char name, int D, int L)
{
new Componant MyComponant = Componant(name,D,L);
}
Thinks !!!
?>
via [php_man]com[/php_man] or [php_man]w32api[/php_man] (which is completely broken in PHP4). There's also php_ffi extension mentioned in user comments on w32api manual page.