As mentioned in my comment, the problem is due to googles encryption error when working with php api. If you have this problem, just use the following replacement functions to fix the encoding.
$data = str_replace('_','/',$result['screenshot']['data']);
$data = str_replace('-','+',$data);
$decoded = base64_decode($data);
source
share