PHP Navision Server

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!

Moderator: General Moderators

Post Reply
Phorem
Forum Newbie
Posts: 20
Joined: Sun Mar 06, 2005 3:58 am

PHP Navision Server

Post 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.
Phorem
Forum Newbie
Posts: 20
Joined: Sun Mar 06, 2005 3:58 am

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

You can use the cURL library extension to connect to another server from within a PHP script.
(#10850)
Phorem
Forum Newbie
Posts: 20
Joined: Sun Mar 06, 2005 3:58 am

Post by Phorem »

Thank you, i will look at that.
Post Reply