LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-02-2005, 07:40 AM   #1
mrobertson
Member
 
Registered: May 2005
Posts: 275

Rep: Reputation: 30
setting up a php web server


I am currently working on a creating a php server to recive values from a vb6 client. It has been suggested to me that I set up a web server......request the url from my vb6 client......pass the values to a php script.....and parse the values out. I am curious what the steps are to create this web server and declare the url that these values will be passed to. I am looking for specific examples or source code that may help me. I am brand new to php coding and this type of programming but am willing to learn. any help would be greatly appreciate. Please include specific code if at all possible.
 
Old 06-02-2005, 07:51 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
To pass a variable in a url you send it as :
http://myhost.net/script.php?MyGreatVariable=AnyValue

(Do not forget to encode it if it contains special chars like space)
And the script.php that get the value :
PHP Code:
<?php
//see if the variable is in $_GET array
if (isset($_GET['MyGreatVariable']) ) {
    
// print the value
    
echo $_GET['MyGreatVariable'];
}
?>
look at www.php.net, very usefull resources for PHP and
a valuable search in php functions feature
 
Old 06-02-2005, 08:04 AM   #3
mrobertson
Member
 
Registered: May 2005
Posts: 275

Original Poster
Rep: Reputation: 30
How do you set up that url and where do you set it up at? Is it set up in vb6 or php. Also how and where do you code the php on a knoppix linux system. I tried to code in the text editor and it is giving me an error on the first line (ie. <?) saying no such file or directory exists. My string that is passed is four variables separated by commas (ex. 1234, 12.44, 56.99, 0.876). Could you explain more about the url in detail as to how exactly to set it up and where also what my host is.........Mygreat variable would be and any value would be.
 
Old 06-02-2005, 11:05 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Well, I know nothing about vb6, I never programmed in windows...
From the questions you are asking, may I suggest you to read
the basic of php here ?
 
Old 06-02-2005, 01:29 PM   #5
mrobertson
Member
 
Registered: May 2005
Posts: 275

Original Poster
Rep: Reputation: 30
I am also having a problem with my php coding I have the following code wrote:

<?
$vars = explode(", ", urldecode($_SERVER["QUERY_STRING"]));
foreach ($vars as $var){
print $var."<br>";
}
?>

I keep getting the same errors:

./PHPServer2.php: line 1: ? No such file or directory
./PHPServer2.php: line 2: Syntax error near unexpected token (
./PHPServer2.php: line 2: '$vars = explode(", ", urldecode($_SERVER["QUERY_STRING"]));


What would be causing this? I am trying to run it from the command line. I even tried to add

#!/usr/bin/php at the beginning of the program but it still didnt work. Any ideas on what is going on here?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up a web server and not only that... axelwing Linux - Newbie 4 05-19-2005 09:40 AM
Setting up a home web server with PHP, MySQL, and a mail client Kyle_D Linux - General 1 01-14-2005 01:52 AM
setting up a slack, apache server with php and a sql server. caged Slackware 1 10-25-2004 04:45 AM
setting up password protected web forms on an apache web server AZDAVE Linux - Security 3 07-07-2004 12:03 PM
Setting a web page with php! mithras Linux - General 14 07-25-2003 03:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration