$factory = (new Factory()) ->withServiceAccount('./secret/firebase_credentials.json') ->withDisabledAutoDiscovery(); $storage = $factory->createStorage(); $defaultBucket = $storage->getBucket(); $uploadOptions = array_filter([ 'name' => $target, 'predefinedAcl' => 'publicRead' ]); $uploadedFile = $defaultBucket->upload(base64_decode($thum), $uploadOptions);
using the Kreait library i was able to add it to my php project and tested it with my project.
when i tried it out from my local machine i was able to upload the image into google cloud storage.
But when i put the same code onto the webhost and try out the same code as on my local machine, i get an error failed to connect to oauth2.googleapis.com port 443.
i dont know whether the webhosting companies dont allow communication with other servers.
This below is the error am getting
Fatal error: Uncaught Google\Cloud\Core\Exception\ServiceException: cURL error 7: Failed to connect to oauth2.googleapis.com port 443: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)