• Home
  • Reviews
  • Articles
  • News
  • Tools
  • GamingHeaven
  • Forums
  • Network
 

Go Back   DriverHeaven.net > Forums > Software / Tools > Programming, Coding, (Web)Design

Notices

Reply
 
LinkBack Thread Tools
Old Jan 9, 2003, 10:40 AM   #1
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

??? 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?
UberLord is offline   Reply With Quote
Old Jan 9, 2003, 11:12 AM   #2
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

Solved it - Content-Type should have prefixed application/
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 02:22 AM   #3
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
ToshiroOC is on a distinguished road

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...
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 06:36 AM   #4
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

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.
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 06:40 AM   #5
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
ToshiroOC is on a distinguished road

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...)...
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 06:53 AM   #6
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

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.
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 06:56 AM   #7
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
ToshiroOC is on a distinguished road

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?
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 07:42 AM   #8
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

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.
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 07:45 AM   #9
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
ToshiroOC is on a distinguished road

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...
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 08:20 AM   #10
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

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
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 08:35 AM   #11
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
ToshiroOC is on a distinguished road

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?
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 08:52 AM   #12
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

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
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 09:01 AM   #13
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
ToshiroOC is on a distinguished road

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?
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 09:48 AM   #14
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

All you need is a decent web server and PHP. RH7.3 should have PHP installed
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 10:23 AM   #15
Colour Commentator
 
digitalwanderer's Avatar
 
Join Date: May 2002
Location: Highland, IN USA
Posts: 5,619
digitalwanderer is an unknown quantity at this point

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?
digitalwanderer is offline   Reply With Quote
Old Jan 10, 2003, 10:32 AM   #16
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,256
UberLord is on a distinguished road

Thumbs Up!

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
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 10:57 AM   #17
Yarr... I be blind!
 
Jeff's Avatar
 
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,177
Jeff is on a distinguished road

Lycos UK is an excellent free web server (its what i set Wyre up on)
Jeff is offline   Reply With Quote
Old Jan 10, 2003, 01:52 PM   #18
BSD SMASH!
 
Malus's Avatar
 
Join Date: May 2002
Location: A rabbit hole. . .
Posts: 1,169
Malus is on a distinguished road

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.
Malus is offline   Reply With Quote
Old Jan 10, 2003, 02:15 PM   #19
Yarr... I be blind!
 
Jeff's Avatar
 
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,177
Jeff is on a distinguished road

yeah.
Jeff is offline   Reply With Quote
Old Jan 14, 2003, 08:25 PM   #20
DriverHeaven Junior Member
 
Join Date: Dec 2002
Location: .at
Posts: 38
TEmp69 is on a distinguished road

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
TEmp69 is offline   Reply With Quote
Old Jan 24, 2003, 05:26 AM   #21
DriverHeaven Junior Member
 
Join Date: Jul 2002
Location: Derby UK
Posts: 78
StuRReaL is on a distinguished road

PHP's great i to am self taught like most of the advanced subjects i know
StuRReaL is offline   Reply With Quote
Old Jan 24, 2003, 07:12 PM   #22
nme
 
Join Date: Dec 2002
Location: Behind You!!
Posts: 389
URWORSTENEMY is on a distinguished road

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!!
URWORSTENEMY is offline   Reply With Quote
 

 
Powered by: vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Artwork by Allan 'Zardon' Campbell, vBulletin implementation by Craig '5320' Humphreys based on original artwork by Ratchet.

All times are GMT -5. The time now is 05:11 AM. Copyright ©2008 HeavenMedia.net