bunch of fixes and improvements

fixed CURLOPT_POSTFIELDS to correspond the test
improved architecture
fixed tests
bumped php version in .travis.yml