PDA

View Full Version : Hey php folks



Norm In Norman
1/26/2006, 10:23 AM
I'm wanting to post some form variables to another page so I don't have to change the code on the page I'm going to (since it isn't my code). I'm trying to implement this:

http://www.zend.com/zend/spotlight/mimocsumissions.php?article=mimocsumissions&kind=sl&id=120&open=0&anc=0&view=1#notes

but I'm using an SSL connection. I changed the code to use https instead of http in the header and I get this back from the server:

Bad Request
Your browser sent a request that this server could not understand.

The request line contained invalid characters following the protocol string.
I assume that it's wanting encrypted data after it sends the protocol. Am I right? Is it worth it for me to try and figure out how to encypt it?

I figure I might as well ask this here. What the hey? Someone might know.

1stTimeCaller
1/26/2006, 10:24 AM
yes.

1stTimeCaller
1/26/2006, 10:26 AM
no.

mdklatt
1/26/2006, 10:29 AM
I assume that it's wanting encrypted data after it sends the protocol. Am I right? Is it worth it for me to try and figure out how to encypt it?


Invalid character--maybe you just need to URL-encode the data? I think PHP has URL-encoding functions.

Norm In Norman
1/26/2006, 10:32 AM
more info

Here are the headers that link is sending:

POST /foo/index.php HTTP/1.1
Host: <A HREF="http://www.zend.com:80/">www.zend.com:80</A>
Content-Type: application/x-www-form-urlencoded
Content-Length: 42
var1=Hello&var2=Zend%20Is%20Cool

Here are the headers I am sending:

POST /eft/menu.php HTTPS/1.1
Host: www.server.com
User-Agent: PostIt
Content-Type: application/x-www-form-urlencoded
Content-Length: 11
pwsend=true

Norm In Norman
1/26/2006, 10:35 AM
Invalid character--maybe you just need to URL-encode the data? I think PHP has URL-encoding functions.
i'm not sure what that is, but I guess it gives me something to look up. I'm a bit of a noob to this stuff. Maybe not a noob, but this stuff is a bit advanced compared to what I've been doing and I know almost nothing about sending headers to a server - except to redirect which I use all the time.

Norm In Norman
1/26/2006, 10:37 AM
Ok, I see there is something called urlencode in their example. I'm looking into it.

Norm In Norman
1/26/2006, 10:37 AM
Oh - that just replaces special characters with %hexvalue.

Norm In Norman
1/26/2006, 10:39 AM
Which is what you were wanting me to do. Duh. And it makes no difference with my example.

mdklatt
1/26/2006, 10:43 AM
Which is what you were wanting me to do. Duh. And it makes no difference with my example.

You don't need URL-encoding in your example, so that wasn't it. I don't know much about HTTPS or sending raw headers but two things come to mind.

1) Your Host line doesn't look like the sample Host line; your URL isn't in the same format.

2) Does your stuff work using plain HTTP? Maybe the HTTPS is tripping it up. HTTPS doesn't use port 80--are you using the right port? There has to be some kind of authentication with HTTPS, doesn't there? Maybe your header is incomplete.

Norm In Norman
1/26/2006, 10:46 AM
Maybe the port 80 thing is the problem. i changed it to port 443 and I get no errors. i get no output too.

Norm In Norman
1/26/2006, 10:48 AM
Oh, and I'm pretty sure that anchor stuff is just them forgetting that the code was in preformat tags.

NormanPride
1/26/2006, 10:49 AM
Don't you need SOAP or something to handle HTTPS? Or am I thinking of something else?

Norm In Norman
1/26/2006, 10:49 AM
I think I'm giving up. It was just an enhancement anyway. Sometime when I have enough time maybe I'll learn all about headers and SSL.

Norm In Norman
1/26/2006, 10:53 AM
I think SOAP has something to do with web services - another thing I'm clueless about.

NormanPride
1/26/2006, 11:01 AM
Yeah, you need to write a webservice to handle HTTPS I think. It handles all the data transfer. But I'm pretty shady on this subject, and you know what they say about a little knowledge...

mdklatt
1/26/2006, 11:09 AM
Maybe the port 80 thing is the problem. i changed it to port 443 and I get no errors. i get no output too.

I think you have to have a lot of extra stuff going on to get HTTPS to work. HTTPS is encrypted so you have to arrange for a key exchange. Authentication is probably involved with this.

NormanPride
1/26/2006, 11:12 AM
yeah, you need a certificate written as well. There's a lot going on just to encrypt some stuff. Seems silly sometimes.