MooSock and PHP problem...
Hello everybody,
I have a ccn application that sends results of a test to a php script that's suppose to write down these results on a file on the server. For many computers, it works fine. But for many others, (mostly from my clients :cry: )it doesn't. Instead, the ccn application receive this kind of message:
[color:#000099]"HTTP/1.1 400 Bad Request (Invalid Verb)"[/color]
or
[color:#000099]"Bad Request"
"Your browser sent a request that this server could not understand. Invalid URl in request ?filename=rezu.csv&password=accesspw&donne e=results,1,1,2,2HTTP/1.0"[/color]
I use a Get method:
Send Text "GET " + "http://mysite.go" + "/this/donnees/myscript.php"
Send Text"?filename="
Send Text"rezu.csv"
Send Text"&password="
Send Text"ecpelpw"
Send Text"&donnee="
Send TextEdittext("edit")
Send Text"HTTP/1.0..."
Does somebody know what's going on?
Many thanks in advance!
Michel Bastien
Re: MooSock and PHP problem...
It looks like you're missing a space or two, specifically one between GET and http, so the server is seeing GEThttp and going "I don't know what a GEThttp command is" (aka, bad verb).
Ok?
EDIT: I think you might be missing a space between the url and HTTP/1.0 as well
Re: MooSock and PHP problem...
Missing a space: well, no. I made a mistake when I wrote down the lines here: there is a space between the GET and the http in the application.
Also, if there was a problem with a space, it would not work at all, wouldn't it? But the MooSock communication always work with some computers and the server and never with some others!
Re: MooSock and PHP problem...
Some servers are very picky on the headers your sending.
It must completely conform to the http specs are they will reject them as spam/dos or some other attack.
Re: MooSock and PHP problem...
I would use "Send text line" rather than "Send text" - otherwise it looks like your lines are going to run into each other. The "HTTP1.0" is being stuck on to the end of your Results field.
Send text line "GET [the entire URL]"
Send text line "From: blah@nowhere.com"
Send text line "User-Agent: HTTPTool/1.0" (or similar)
Send text line ""
Disconnect
Re: MooSock and PHP problem...
I said this because of your message from the server that said "?filename=rezu.csv&password=accesspw&donn ee=results,1,1,2,2HTTP/1.0", managing to miss the page name out of the url (suggests that you missed a space between get and the page name) and it's welded HTTP/1.0 to the end, suggesting that you missed a space there too.
If you'd like to post your code (as in the actual file) I'm sure we could figure out what was wrong.
Re: MooSock and PHP problem...
Yes, I well examine the spaces in my command lines carefully.
And I will try the Send text line commands too.
I will send my code as in the actual file in a few moments.
But can you take a look at the message from the server again: between values, I see "&" but my app's instructions just send the "&". Could it be that some computers are mistakingly interpreting my ampersand character?
(And, btw, if you type an ampersand in, will it look like mine?)
Re: MooSock and PHP problem...
I did wonder about the & characters - I think it might be the error reporting bit of code interpreting them, though I'm not sure.
Re: MooSock and PHP problem...
There: you can take a look to my code:
To my message in the File Forum
About the ampersand: yes, I use a French-Canadian keyboard and it would not be the first time I have a problem with special characters like this and some MMF functions. (If somebody knows a way around...) And it would maybe explain why my app works on some computers (those with a French-Canadian keyboard setting) and not with others (those with an English setting)...
Re: MooSock and PHP problem...
Ok, it works for me, and I have a uk keyboard setting. I get "HTTP/1.1 200 OK". I tried it against my own web server and I get "HTTP/1.1 404" (not found) but that's right because I don't have your script on my server.
It's worth remembering that you're not supposed to send the web address as part of the url, you should really send it is a header, like this:
GET /page/?data HTTP/1.1
Host: xyz.site.com
also, you shouldn't actually send the http:// bit either. Perhaps the people it's failing for are behind a transparent proxy / router of some kind which is not liking your non-standard request?