You could use phpseclib, a pure PHP SSH implementation, to do this easily enough:
<?php
include('Crypt/RSA.php');
include('Net/SSH2.php');
$key = new Crypt_RSA();
//$key->setPassword('whatever');
$key->loadKey(file_get_contents('privatekey'));
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', $key)) {
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
?>
phpseclib seems to support quite a few different key formats:
http://www.frostjedi.com/phpbb/viewtopic.php?f=46&t=15226
The fact that ssh2_auth_pubkey_file() requires both the public and private key is silly since 99% of the time the private key has the public key embedded within it. But whatever - it's not like they asked me lol.