在非常严格的安全Web服务器上的PHP替代php

I have to connect to external server (lets name it server B) inside my php script. The easiest way to do that would be by using SSH2. But ssh2 is blocked due to security reasons and Net_SSH2 doesn't work (probably for the same reasons). And for now I have no possibility to turn SSH on, or change this webhosting. Thankfully cURL is working and I'm thinking about some alternatives.

The only thing that comes to my mind is to just write some perl script on this server B, put it into cgi-bin, then to connect to this script through cURL using some authentication and run some things on server B.

Unfortunately this mean to write some authentication and stuff, there are a lot of potential problems with security and stuff.

Anyone have a better idea how to overcome this problem?

Thanks