I'm very frustrated right now. I want to make a restful service in PHP. I want it so that when you access a resource, https://server.com/foo.php, you are given a 'general public' view.
I also want it, so that if you supply credentials ala HTTP Basic Auth, you are given a user specific view.
That way, I can let things crawl my data, and if they have a user / pass, they can see more info.
Foolishly, I thought this would be trivial.
Problems:
1. Testing via https://user:pass@server.com/foo.php does not populate the $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] variables.
2. User agents fight you if you use the above - Firefox bugs me about it.
3. PHP itself cannot capture the user:pass fragment of the URL as far as I can tell; so I can't even fake it.
4. User agents don't send credentials unless they get a challenge - so I need to write my own to send unasked for HTTP Basic Auth details, in order to populate the required variables. This means tools like wget make my restful service useless to crawl. PITA.
5. If I want to provide a 'login' page which does trigger the challenge / authenticate mechanism, I have to create it as a seperate page or an extra query bit in the URI. That's certainly not standardised.
Half person, half home automation, an under loved blog for all things Ruby, python and more in Adelaide
Wednesday, August 26, 2009
Tuesday, August 04, 2009
Sprained Ankles and the power of Google
About a week and some ago, while playing touch footy, I sprained my ankle.
It was incredibly painful and surprising for someone like myself who'd never broken a bone or otherwise hurt himself more than in a rudimentary fashion.
I googled around after a while, reluctant to contact a physio, whom after a relationship with someone studying the said subject at uni, I was a bit hesitant to talk to as a profession in all.
Google's advice to someone like me - RICE (Rest, Ice, Compression, Elevation), grab a compression bandange, and see your doctor to check if it needs an xray.
Having the aforementioned ex on hand when I injured it, I had the ice bit down pat - unfortunately, while I was afraid I'd applied right angles to my ankle; the best efforts she could give were "I'm not insured to look at it, here, have some ice", as well as the other physio students who were playing on my team.
I was pretty pissed about that, after having pretended to be a cripple for X number of homework assignments, and the best a real cripple can get is indifference.
Anyway, after more use of Google, I got off my behind, and grabbed a tubular ankle bandage which applied a degree of compression - not heaps, but some.
That got me walking on it again, so I was somewhat happy.
Again, I turned back to Google, after a colleague pointed out "that thing looks nasty!" in reference to my ankle, and booked in a physio appointment located... by google.
After a bit of cursory examination, it's declared a grade one sprain, in the Anterior talo-fibular ligament and another one.

The treatment regime? Get the edema/swelling down, some exercises to perform, and NMES on the affected ankle.
Curious about why I needed my foot electrocuted, I ... you guessed it, googled.
I found NMES on standing people, which reassured me, and was from the era my physio graduated in.
Unfortunately, it doesn't appear he's kept up with his reading, because I found other papers, which sum up to "what you'd normally do... doesn't do much".
So, what's the tally here:
* Google helped me apply early treatment (incorrectly, the compression was insufficient), located me a professional within 500m my work, located the reason why I was being electrocuted and also evidence that I'd just vastly overpaid for not much.
* Physios treated me with indifference, electrocuted me, charged me lots, identified the specific regions affected, gave me excercises, corrected the compression tool I was using, derrided me for using the internet.
The difference?
One is a machine that indexes what other physios have written on the subject, the other is a profession which can't possibly keep up to date, has a few specialised techniques which are hard to textually communicate, and charge through the ass to use them.
Does this mean we can throw out the entire medical profession for computers? No. Does it mean I'm angry I'm paying through the ass to get treatment I know doesn't work?
Hell yes.
It was incredibly painful and surprising for someone like myself who'd never broken a bone or otherwise hurt himself more than in a rudimentary fashion.
I googled around after a while, reluctant to contact a physio, whom after a relationship with someone studying the said subject at uni, I was a bit hesitant to talk to as a profession in all.
Google's advice to someone like me - RICE (Rest, Ice, Compression, Elevation), grab a compression bandange, and see your doctor to check if it needs an xray.
Having the aforementioned ex on hand when I injured it, I had the ice bit down pat - unfortunately, while I was afraid I'd applied right angles to my ankle; the best efforts she could give were "I'm not insured to look at it, here, have some ice", as well as the other physio students who were playing on my team.
I was pretty pissed about that, after having pretended to be a cripple for X number of homework assignments, and the best a real cripple can get is indifference.
Anyway, after more use of Google, I got off my behind, and grabbed a tubular ankle bandage which applied a degree of compression - not heaps, but some.
That got me walking on it again, so I was somewhat happy.
Again, I turned back to Google, after a colleague pointed out "that thing looks nasty!" in reference to my ankle, and booked in a physio appointment located... by google.
After a bit of cursory examination, it's declared a grade one sprain, in the Anterior talo-fibular ligament and another one.

The treatment regime? Get the edema/swelling down, some exercises to perform, and NMES on the affected ankle.
Curious about why I needed my foot electrocuted, I ... you guessed it, googled.
I found NMES on standing people, which reassured me, and was from the era my physio graduated in.
Unfortunately, it doesn't appear he's kept up with his reading, because I found other papers, which sum up to "what you'd normally do... doesn't do much".
So, what's the tally here:
* Google helped me apply early treatment (incorrectly, the compression was insufficient), located me a professional within 500m my work, located the reason why I was being electrocuted and also evidence that I'd just vastly overpaid for not much.
* Physios treated me with indifference, electrocuted me, charged me lots, identified the specific regions affected, gave me excercises, corrected the compression tool I was using, derrided me for using the internet.
The difference?
One is a machine that indexes what other physios have written on the subject, the other is a profession which can't possibly keep up to date, has a few specialised techniques which are hard to textually communicate, and charge through the ass to use them.
Does this mean we can throw out the entire medical profession for computers? No. Does it mean I'm angry I'm paying through the ass to get treatment I know doesn't work?
Hell yes.
Subscribe to:
Posts (Atom)