Every ?coind has an RPC command called getdifficulty to fetch current difficulty.
ummm. what? Lol
If you run bitcoind, namecoind, devcoind and keep them synced with the network, it's as easy as
$ bitcoind getdifficulty
1250757.73927466
at the shell, or via HTTP RPC requests if you set that up.
I'm not so sure if the person I'm helping have that installed, how can I tell and how can I call it via php. Sorry if I'm asking too much.
You can check by trying "bitcoind getdifficulty" at the command line and seeing if it works. If it does, the PHP is simple:
$difficulty = (float)`bitcoind getdifficulty`;
echo "Difficulty is ", $difficulty, "\n";
The "`" symbols are the "backtick operator", but
shell_exec() is equivalent. Replacing bitcoind with namecoind, etc., would make it work for all chains, if all the servers are installed and running.
From the sounds of it installing and maintaining nodes for each chain is more complicated than you want. The APIs at
http://blockexplorer.sytes.net/q might meet your needs, but last I looked some of the chains were out of date, and it seems to be down right now. I also couldn't figure out how to use the relevant API call -- it would be something like
http://blockexplorer.sytes.net/chain/Bitcoin/q/nethash , but I couldn't figure out how to narrow it to just the current difficulty.