Problem with query from PHP script

I assumed he is verifying on some minimal examples with CLI, but okay. Any way to provide implementation would work, but not invocation of actual encoder.