HardwareHeaven.com

HardwareHeaven.com

Looking for the skin chooser?
 
 
  • Home

  • Hardware reviews

  • Articles

  • News

  • Tools

  • Gaming at HardwareHeaven

  • Forums

 

Go Back   HardwareHeaven.com > Forums > Software / Tools > Programming, Coding, (Web)Design


Programming, Coding, (Web)Design Discuss all your programming or design needs with likeminded people.

Reply
 
Thread Tools
Old Jan 9, 2003, 03:40 PM   #1
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

??? 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?
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote


Old Jan 9, 2003, 04:12 PM Threadstarter Thread Starter   #2
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

Solved it - Content-Type should have prefixed application/
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 07:22 AM   #3
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0
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...
__________________
[img][/img]
[color=White]Peace be with you, Joe.[/color]
Driverheaven Staff Member (Supermoderator)
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 11:36 AM Threadstarter Thread Starter   #4
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

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.
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 11:40 AM   #5
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0
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...)...
__________________
[img][/img]
[color=White]Peace be with you, Joe.[/color]
Driverheaven Staff Member (Supermoderator)
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 11:53 AM Threadstarter Thread Starter   #6
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

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.
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 11:56 AM   #7
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0
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?
__________________
[img][/img]
[color=White]Peace be with you, Joe.[/color]
Driverheaven Staff Member (Supermoderator)
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 12:42 PM Threadstarter Thread Starter   #8
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

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.
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 12:45 PM   #9
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0
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...
__________________
[img][/img]
[color=White]Peace be with you, Joe.[/color]
Driverheaven Staff Member (Supermoderator)
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 01:20 PM Threadstarter Thread Starter   #10
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

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
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 01:35 PM   #11
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0
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?
__________________
[img][/img]
[color=White]Peace be with you, Joe.[/color]
Driverheaven Staff Member (Supermoderator)
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 01:52 PM Threadstarter Thread Starter   #12
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

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
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 02:01 PM   #13
Unbiased.
 
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0
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?
__________________
[img][/img]
[color=White]Peace be with you, Joe.[/color]
Driverheaven Staff Member (Supermoderator)
ToshiroOC is offline   Reply With Quote
Old Jan 10, 2003, 02:48 PM Threadstarter Thread Starter   #14
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

All you need is a decent web server and PHP. RH7.3 should have PHP installed
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 03:23 PM   #15
Colour Commentator
 
digitalwanderer's Avatar
 
Join Date: May 2002
Location: Highland, IN USA
Posts: 5,619
Rep Power: 0
digitalwanderer will become famous soon enough

Donator
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?
__________________
WTF is up with the sigs?
digitalwanderer is offline   Reply With Quote
Old Jan 10, 2003, 03:32 PM Threadstarter Thread Starter   #16
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

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
__________________
Gentoo Linux - Developer (baselayout)
Read my blog

"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours."
Stephen Roberts
UberLord is offline   Reply With Quote
Old Jan 10, 2003, 03:57 PM   #17
Yarr... I be blind!
 
Jeff's Avatar
 
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,191
Rep Power: 80
Jeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud of

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, 06:52 PM   #18
BSD SMASH!
 
Malus's Avatar
 
Join Date: May 2002
Location: A rabbit hole. . .
Posts: 1,170
Rep Power: 0
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.
__________________
quad (FreeBSD/amd64 8-CURRENT): Intel Q6600 - Asus P5E-VM HDMI - 2x2 GB Kingston PC6400 DDR2 Ram - Seagate 320GB 7200RPM HD - 2xSeagate 1TB 7200RPM HD in RAID 1 via ZFS - Lite-On 20x DVD Multi Recorder - Coolermaster Centurion 5

router (FreeBSD/amd64 8-CURRENT):
Intel E4500 - Intel D945GCNL - 2 GB PC6400 Mushkin Ram - Lite-On 48x24x48x16 - Seagate 320GB 7200RPM HD - Silverstone SST-SG02-F

wanderer (FreeBSD/i386 7-CURRENT): Lenovo Thinkpad T61p

mini (OS X 10.5): Intel Core 2 Duo @ 1.8Ghz, 4 GB Mushkin PC5400 Ram -
Headroom MicroDAC

Portable sound: Rockboxed iPod Video -> Westone UM2's
Not-So-Portable Sound: Headroon MicroDAC -> Singlepower PPX3-SLAM -> Grado RS-1's or Beyerdynamic DT-880's
Very-Not-Portable-Sound: Squeezebox v3 -> Denon AVR-1507 -> B&W 683's & Sunfire HRS-10
Malus is offline   Reply With Quote
Old Jan 10, 2003, 07:15 PM   #19
Yarr... I be blind!
 
Jeff's Avatar
 
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,191
Rep Power: 80
Jeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud ofJeff has much to be proud of

yeah.
__________________
Jeff is offline   Reply With Quote
Old Jan 15, 2003, 01:25 AM   #20
DriverHeaven Junior Member
 
Join Date: Dec 2002
Location: .at
Posts: 38
Rep Power: 0
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, 10:26 AM   #21
DriverHeaven Junior Member
 
Join Date: Jul 2002
Location: Derby UK
Posts: 78
Rep Power: 0
StuRReaL is on a distinguished road

PHP's great i to am self taught like most of the advanced subjects i know
__________________
AMD Athlon64 X2 4200+
1GB OCZ Platinum
x2 74Gb WD Raptors RAID0
256mb Radeon X1300
Sapphire Pure Innovation
M-Audio Revolution 7.1
Windows XP x64 Edition
StuRReaL is offline   Reply With Quote
Old Jan 25, 2003, 12:12 AM   #22
nme
 
Join Date: Dec 2002
Location: Behind You!!
Posts: 389
Rep Power: 0
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
Reply

Thread Tools