Streaming live at 10am (PST)

Using a PHP cURL Request in Webflow?

I am wanting to use a PHP cURL POST Request for a form on Webflow. To send the form data to an external database. What is the best way to apply this in Webflow?

My ideas are to host it through an external site? (AWS s3 bucket?) Wanted to get some advice on the best way to accomplish this.

Let me know if you need more information.

You could certainly host it on S3, and use Lambda or a hosted php script somewhere to do this. You need to change the Action of a form in the form settings to post to that location instead.

If you’re comfortable with using AWS then it’s not really any different to using standard external hosting and handling form submissions there.

If you search the forum here for Ajax submissions you can find a handful of ways to make it a little more elegant too.

1 Like

Hi @iratefox

Thank you for the reply.
Could I please ask if you could elaborate more on this?

I am trying to understand where to host what. So would I just load the simple PHP cURL file on s3? Then use lambda to execute the PHP cURL when my Webflow form has been submitted? I have done some research but am just lost myself with the layers of the techs.

Let me know if I can explain more or give more information.

Any help is highly appreciated! Thank you

The setup I was thinking of would be to host the website’s static files on S3, probably front-load that with Cloud Front CDN. You’d need to utilise Route 53 to setup the aname routing and Cloud Front layer too.

Then the dynamic bits: I’d create an API end point using API Gateway and using a php driven Lambda function to handle the cURL request.

If you’re more used to a typical hosting setup and the site is small then there’s not really any need to go for a setup like this - you may be more comfortable in spinning up a Lightsail server and putting that behind Cloud Front (or any other CDN) to handle the static elements in the same way while still routing to the php file as you want.

Utilising all of the AWS functions can be a bit of a burden for small projects. It’s fantastic for applications that require automatic scaling and reducing bare metal server management requirements, but it’s not for every project so carefully consider whether you need it this way would be my advice.

1 Like

Thank you, this information is incredibly helpful.

I have an incredibly simple setup. Just using a Webflow forum, then using a PHP file that has the cURL request which I need to be hosted so it can be used in the Webflow custom code. When the form submits then this will trigger the cURL request.

So using a Lightsail server to host the file? Then using Cloud Front to execute the file?
I am also assuming I can just import the file through custom code Webflow (Similar to S3 Bucket).

Sorry if I am going way too much in fine detail. Just new to some of this tech and trying to understand the cycle of hosting.

Sorry for the delay…

You have a few options;

You can put the whole site on a Lightsail server then just put a CDN like Cloudfront in front of that.

Or you can put the site files on S3, the cURL file on Lightsail, and as long as the submission address is pointing to the Lightsail file path then that’ll work with Cloudfront in front of that setup too.