|
| Notices |
Welcome to the DriverHeaven.net forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
 |
Jan 9, 2003, 10:40 AM
|
#1
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
POST fails but GET works?
Got a little problem with VB6, MSXML2.XMLHTTP and a C# web service.
Here's a VB6 code snippet
Code:
mHTTPd.open "POST", "http://roy/net.daq/schedule.asmx/getXMLid", False
mHTTPd.setRequestHeader "Content-Type", "x-www-form-urlencoded"
mHTTPd.send "id=666"
Post = mHTTPd.responseText
That causes an Error 500 - Internal Server error sent back from IIS
Code:
mHTTPd.open "GET", "http://roy/net.daq/schedule.asmx/getXMLid?id=666", False
mHTTPd.setRequestHeader "Content-Type", "x-www-form-urlencoded"
mHTTPd.send
Post = mHTTPd.responseText
That works just fine and gets me my output.
Here's the c# web service it's calling
Code:
[WebMethod]
public XmlDocument getXMLid(string id)
{
XmlDocument x = new XmlDocument();
x.LoadXml("<schedule id=\"" + id + "\">test</schedule>");
return x;
}
Now, I know the code isn't much (it's just a test case to prove this "works" - lol) but I really need POST to start working as I'll be posting some very large stuff here when the webservice goes into production.
BTW, the post code works on an Apache internet server running PHP just fine. My task is to re-write the PHP in .NET as a web service.
I actually told a small lie - if I remove the parameter "id" from the C# web service it works just fine, so it's a parameter problem i think. But why does it work with GET and not POST?
Ideas anyone?
|
|
|
Jan 9, 2003, 11:12 AM
|
#2
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
Solved it - Content-Type should have prefixed application/ 
|
|
|
Jan 10, 2003, 02:22 AM
|
#3
|
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
|
Interesting - I have always wanted to learn this sort of stuff, PHP, webserving and all but I have never had the time - until now. I am wondering, how did you learn to do this? Did you teach yourself? If so, could you recommend some teach-yourself sources for webserving? I have linux installed, and a decent internet connection...
|
|
|
Jan 10, 2003, 06:36 AM
|
#4
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
I'm 100% self taught. PHP is a good starter language and it's easy to find a web host that allowss PHP. I'd recommend picking up "Teach yourself PHP4 in 24 hours" published by SAMS. Very good book.
|
|
|
Jan 10, 2003, 06:40 AM
|
#5
|
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
|
Thanks for the help - I'm sure I can figure something out, even if it ends up being only doing it on my own computer and then surfing it from my end of things... what can PHP do that HTML/XML/Javascript can't? I've heard all of them in diffent contexts, and though I know what HTML is for, I don't know that the rest is for...... I already know some basic languages and C++ (minimally - I'm just getting to polymorphism...)...
|
|
|
Jan 10, 2003, 06:53 AM
|
#6
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
HTML is a document markup language that tells the browser what font to use, where the text goes, etc. XML is a data markup language. Javascript is like a small program that runs in the browser. PHP is like a program that only works on the server and the output is sent back to the browser as HTML.
|
|
|
Jan 10, 2003, 06:56 AM
|
#7
|
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
|
DAMMIT! PHP is then somewhat like something I thought of - an HTML generating program language... and someone already thought of it! DAMMIT!  But thats cool, it sounds useful - when I see things suffixed with .php, like on this website, does that mean that they are being handled by some PHP script on the Driverheaven server?
|
|
|
Jan 10, 2003, 07:42 AM
|
#8
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
Quote:
Originally posted by ToshiroOC
when I see things suffixed with .php, like on this website, does that mean that they are being handled by some PHP script on the Driverheaven server?
|
Bingo.
You never see the PHP code yourself as the webserver runs it and then removes it. You can bundle HTML into PHP. For example
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=<?php print strtolower(CHARSET); ?>" />
<meta name="robots" content="noindex, nofollow" />
<?php
print "<link href=\"".STYLESHEET."\" rel=\"stylesheet\" type=\"text/css\" />\n";
if ($ua->browser == BROWSER_IE) {
positionAbsoluteBodge();
}
print $h_autologout.$h_style.$headercode;
?>
<title>NetDAQ</title>
</head>
The above code is a direct snippet from some of my work - so it's not complete.
If you look closely, you can see <?php which denotes the start of PHP code and ?> which denotes the end of PHP code. What my code essentially does here is to allow a userdefinable character set defined elsewhere by the variable CHARSET. It also rejigs some CSS positioning code if Internet Explorer is being used.
All this is invisible to the end user. One benefit is that one set of code is sent to the browser instead of 2 (1 for Mozilla, 1 for IE) which saves on bandwidth.
|
|
|
Jan 10, 2003, 07:45 AM
|
#9
|
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
|
Interesting - is this standard fare for PHP implementation, or is this a somewhat more complex implementation. The spacing is making everything seem somewhat complex, along with the system variables (or whatever you call $ prefixed vars...), and I can only sorta make out what is going on because of the naming of the variables...
|
|
|
Jan 10, 2003, 08:20 AM
|
#10
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
Remember that my code snippet is only a partial one. $ represents a variable. -> represents a method or propety of an object. I chose to make all constants in UPPERCASE
|
|
|
Jan 10, 2003, 08:35 AM
|
#11
|
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
|
Can you have standalone scripts which don't require surrounding by html? (Say, a script that generates HTML without having any HTML pre-written...), and how CPU intensive are PHP scripts?
|
|
|
Jan 10, 2003, 08:52 AM
|
#12
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
Yes you can have PHP scripts without any HTML. Infact, they're making a PHP component that allows PHP scripts in run on your PC and act like a full program
PHP scripts aren't too intensive on the server - compared to certain MS equivalents 
|
|
|
Jan 10, 2003, 09:01 AM
|
#13
|
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
|
Sounds interesting - I'll go get that book sometime tommorow and start going through it  Do I need any special software to run the scripts? I have Red Hat 7.3 somewhere on my computer with an 80gb hard drive dedicated to it... and I installed everything possible for it... so could/should I do it in there, and if so, will the SAMS book say so or would I have to learn some linux first?
|
|
|
Jan 10, 2003, 09:48 AM
|
#14
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
All you need is a decent web server and PHP. RH7.3 should have PHP installed 
|
|
|
Jan 10, 2003, 10:23 AM
|
#15
|
|
Colour Commentator
Join Date: May 2002
Location: Highland, IN USA
Posts: 5,619
|
Quote:
Originally posted by UberLord
it's easy to find a web host that allowss PHP.
|
Like spit it is! I basically had to blackmail my ISP just to get FTP access to my own account there, and I'm good friends with their head tech guy!
Most ISPs I know of will NOT allow you PHP access, or am I thinking something different here. (PHP is a script that runs server-side, right?)
I've always wanted to get into that, but me fave ISP won't let me. You really think most do?
|
|
|
Jan 10, 2003, 10:32 AM
|
#16
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,256
|
Quote:
Originally posted by digitalwanderer
You really think most do?
|
A lot of UK based ISP's do. Wyre use Lycos for his personal homepage as it's free and allows PHP and mySQL
|
|
|
Jan 10, 2003, 10:57 AM
|
#17
|
|
Yarr... I be blind!
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,177
|
Lycos UK is an excellent free web server (its what i set Wyre up on)
|
|
|
Jan 10, 2003, 01:52 PM
|
#18
|
|
BSD SMASH!
Join Date: May 2002
Location: A rabbit hole. . .
Posts: 1,169
|
Quote:
Originally posted by Cyborg
Lycos UK is an excellent free web server (its what i set Wyre up on)
|
I find that it can be slow from time to time. Can't really find anything better though, since it is free.
|
|
|
Jan 10, 2003, 02:15 PM
|
#19
|
|
Yarr... I be blind!
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,177
|
yeah.
|
|
|
Jan 14, 2003, 08:25 PM
|
#20
|
|
DriverHeaven Junior Member
Join Date: Dec 2002
Location: .at
Posts: 38
|
Code:
<?php
//////////////////////////////////////////////////////////////////
// CONFIG:
/////////////////////////////////////////////////////////////////
// ENTER the name of the banner ie:
// if its called Banner0.gif - Banner10.gif just enter
// $image="Banner"
$image="Banner_vs";
// next what we need is how many banners do you have
$count=1;
// last but not least the extension
$extension=".gif";
// width from the banners (keeping it the same for all)
$width=500;
// height from the banners (keeping it the same for all)
$height=100;
// thats it!!!!
// the actual random banner line is right below and should
// be selfexplaining!!!
/////////////////////////////////////////////////////////////////
$banner='<img src="'."$image".rand(0,$count)."$extension".'" width="'.$width.'" height="'.$height.'">';
?>
Random banner code, quick and dirty.
Now all you need is to "echo" the "banner" variable within a php statement and you have random banners for your site.
Btw. you dont really need a book to learn this scripting language, if you know a bit C, the syntax is selfexplaining, all you need is what functions are already there and this you can get at sites like www.php.net
|
|
|
Jan 24, 2003, 05:26 AM
|
#21
|
|
DriverHeaven Junior Member
Join Date: Jul 2002
Location: Derby UK
Posts: 78
|
PHP's great i to am self taught  like most of the advanced subjects i know 
|
|
|
Jan 24, 2003, 07:12 PM
|
#22
|
|
nme
Join Date: Dec 2002
Location: Behind You!!
Posts: 389
|
I really have an urge to learn a programming language.
Reading this thread really enforces this
I think ill buy the book UberLord suggests and make a start
Im a total prog language virgin, apart from a little BASIC many years ago
Im really gonna make time for this and try to get a grasp on it
My only real problem is making the time!!
|
|
|
|
|
|