WooHoo! That looks fun 😉
Some its I noticed. Should:
"POST_$URI_HTTP/1.1\n".
be:
"POST_".$URI."_HTTP/1.1\n".
(I notices a few occurances of this type of thing in this code.)
I've successfully done it in the past writing raw HTTP, however that doesn't help you here.
Is the URL the only thing you are trying to stop? I'm guessing you are trying to have links to specific places. You could get rid of them using javascript to fill in hidden things (sorry, that word has just completley escaped me!), and then using the "OnCLick" event to trigger changing those values and triggering the post action.
Personally, I would prefer using the URLs to a solution like this, it just doen't seem worth the effort.