Sending data to aws using api - php

I need to send an image to aws using an API in PHP. The image comes from the webcam, I have set up the aws as well, the backend neural network on aws is in python. I need to directly take the image I get from the webcam and send it to the backend and the neural network should start processing the image. How do I write an API call to the backend? And how do I start the backend code in one swift flow, without having to run the backend separately?

in aws beckend which aws you are using please speify your so other can understand and suggest you path as per it.
you can do one thing upload image to s3 and trigger lambda if image uploaded to s3 using lambda you can trigger other services. if you are using lambda as beckend service then it will easy
https://docs.aws.amazon.com/lambda/latest/dg/with-s3.html
.

Related

Amazon Lambda with PHP

I have a database (MySQL) created in Amazon RDS. Also created a PHP class for connecting to that database and which will return some webservice as JSON format according to the request. Which I am using for my mobile and Angular applications.
Currently I am hosting that php file in one of my GoDaddy server and calling that PHP file from the app(s).
My question is - can I use AWS Lambda for this purpose (for deploying php file ) ? In some tutorials I found Lambda will not support PHP.
The PHP file serves the following functionalities
Creating various JSON files from MySQL table.
Uploading images to Amazon S3 bucket.
Sending push notifications (FCM) to Android / iOS devices.
AWS Lambda currently does not support PHP.
You could use any one of the supported languages for your purpose.
For push notifications you could use SNS
Read more: https://aws.amazon.com/lambda/faqs/

php Api hosted on AWS s3 bucket

I wanna host a php file that retrieve data from a mysql DB how ever aws is not authorizing POST method.
I need to know how can I add the code in PHP knowing I already configured the Bucket policy and CORS
You can only serve static content from an S3 - PHP will not be processed.
If you want to set up a dynamic PHP website on AWS have a look at LightSail and its LAMP stack.
You should try Amazon API Gateway.

Can files be uploaded to a compute engine on GCP using an application page written in php/html?

Can we upload image files to a GCP running compute engine directly using PHP?
I know that it can be done using the backend ssh on GCP.
I have a solution that works in my local system to upload files but does not work on GCP.
Based on initial research it appears that GCP does not allow file upload directly.
Need confirmation though or if there is a way in which file upload can work, please enlighten.
I do not think it can be done directly through php, through ssh yes.
You can upload files with PHP.
If you want to upload to the server local disk, things become a bit simpler. Just ensure you have PHP configured for upload: PHP File Upload
If you want to upload to Google Storage, say to a bucket, you'd need to authenticate and get access there. Google Cloud SDK can provide this. Then you can install API Client Libraries for PHP and optional Cloud SDK components. That way you might call gcloud shell command or use API. Cloud SDK will provide transparent connection and authentication for you so that you can upload to the Google Storage.
Please see:
Cloud SDK
Google API Client Libraries

PHP via Amazon S3 for Android App

I have developed an Android app which does a GET/PUT operations with a test web server for fetching and storing data in JSON format. For PUT using a PHP script on webserver via parameters in url. Now to scale the solution, i am exploring AWS solutions. How to achieve PHP script based logic handling on webserver with AWS S3 or any other cloud based storage which can perform this php based logic handling.
I would recommend to use AWS Lambda- It doesn't need servers to be hosted and maintained, which is a big headache. With AWS Lambda, in few minutes you can get your web application running. Your PHP scripts can be hosted as service and AWS will take care of its scalability and availability.
https://www.youtube.com/watch?v=eOBq__h4OJ4
https://aws.amazon.com/serverless/build-a-web-app/
https://aws.amazon.com/blogs/compute/scripting-languages-for-aws-lambda-running-php-ruby-and-go/
AWS S3 you can use for storing your static files like images, css, javascript etc...

Upload and retrieve images from Google Cloud Storage on the Android app

I am building an android app where users need to upload & retrieve the images. I need to do that with the Google Cloud Storage. How can I do that if there is a way? I have used PHP as a backend & APIs. I see that they provide APIs for that but there is no way of direct implementation with the PHP. The backend and APIs' code is uploaded on the Google Compute Engine.
You could either upload the image on your frontend and give the url of the image to your BackEnd. Or you could use the GCS JSON API from your php backend to upload the image from there. Here is an example of using the JSON API to upload an image to cloud storage, but in the end it's just a simple POST request which can easily be done in php.
Further info:
https://cloud.google.com/storage/docs/json_api/
https://cloud.google.com/storage/docs/json_api/v1/json-api-php-samples

Categories