Page 1 of 1

PHP Navision Server

Posted: Mon Jun 12, 2006 2:12 pm
by Phorem
I have a Navision Server on a Windows Network that REQUIRES you to use their C/ODBC driver on a Windows machine to make a connection through ODBC - i.e. there is no Linux driver.

My problem lies in the fact that i can parse the database using PHP and get the information i need but i don't want the Windows machine to be my "Primary" server.

What i was hoping, was to just have a "connection.php" file on the windows machine that would be used on the Linux server in a php script with "include ". Now, i can get the posted value to the Windows server and i can see reults IF VIEWED from the Windows Apache server but what i want is to have the "connect.php" hold the values so that i could use those on my Linux server.

So, far, i have tried many things - mostly stuff like

Code: Select all

//  "connect.php"


<?php 


// Start the session
session_start();

    //connect to the database 
    $connectionstring = odbc_connect('SysDSN','user','password'); 

    //SQL query 
	
	$Query = " SELECT Ship_to_Address.Customer_No_, Ship_to_Address.Name FROM Ship_to_Address WHERE Ship_to_Address.Customer_No_='666'";

   //execute query 
    $queryexe = odbc_do($connectionstring, $Query); 

while(odbc_fetch_row($queryexe)) 
{ 
	
    	$name = odbc_result($queryexe, 1);
	$name2 = odbc_result($queryexe, 2); 

}

// echo $name; - this does print a result.

?>
And on my Linux server, i have tried using using

Code: Select all

<?

// Start the session
session_start();

include 'http://remote-windows-server/connect.php';

echo $name;

?>
Before i get an earfull of "Google and Look here and Look there!!" - well i have. I just don't know how to ask the right question.

Basically - in it's simplest form - i want to use variables established on the Windows machine on my Linux machine.

And yes i could make it nice and messy using POST or GET (maybe a little Redirect in there for goog measure) but i'm not really good with PHP and i have no clue how to carry the values over seamlessly.

Any help would be great. Thank you.

Phorem.

Posted: Tue Jun 13, 2006 3:15 pm
by Phorem
I just ended up using GET and a zero second redirect. Dirty but, it works...i guess.

If anyone else has any ideas, let me know.

Posted: Tue Jun 13, 2006 3:19 pm
by Christopher
You can use the cURL library extension to connect to another server from within a PHP script.

Posted: Tue Jun 13, 2006 5:07 pm
by Phorem
Thank you, i will look at that.