api-sample: use non blocking sockets

fix php warnings and enable cpuminer compat