|
|||||||
| Programming, Coding, (Web)Design Discuss all your programming or design needs with likeminded people. |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
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
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
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;
}
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 |
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#3 |
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0 ![]() |
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) |
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#5 |
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0 ![]() |
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) |
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#7 |
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0 ![]() |
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) |
|
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
Quote:
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>
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 |
|
|
|
|
|
|
#9 |
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0 ![]() |
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) |
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#11 |
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0 ![]() |
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) |
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#13 |
|
Unbiased.
Join Date: Jun 2002
Posts: 4,812
Rep Power: 0 ![]() |
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) |
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
__________________
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 |
|
|
|
|
|
#15 | |
|
Colour Commentator
Join Date: May 2002
Location: Highland, IN USA
Posts: 5,619
Rep Power: 0 ![]()
|
Quote:
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? |
|
|
|
|
|
|
|
|
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
Quote:
__________________
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 |
|
|
|
|
|
|
#17 |
|
Yarr... I be blind!
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,191
Rep Power: 80 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Lycos UK is an excellent free web server (its what i set Wyre up on)
__________________
|
|
|
|
|
|
#18 | |
|
BSD SMASH!
Join Date: May 2002
Location: A rabbit hole. . .
Posts: 1,170
Rep Power: 0 ![]() |
Quote:
__________________
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 |
|
|
|
|
|
|
#19 |
|
Yarr... I be blind!
Join Date: May 2002
Location: Calgary, Canada
Posts: 3,191
Rep Power: 80 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
yeah.
__________________
|
|
|
|
|
|
#20 |
|
DriverHeaven Junior Member
Join Date: Dec 2002
Location: .at
Posts: 38
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#21 |
|
DriverHeaven Junior Member
Join Date: Jul 2002
Location: Derby UK
Posts: 78
Rep Power: 0 ![]() |
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 |
|
|
|
|
|
#22 |
|
nme
Join Date: Dec 2002
Location: Behind You!!
Posts: 389
Rep Power: 0 ![]() |
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!! |
|
|
|
![]() |
| Thread Tools | |
|
|