Redirects vs cUrl

Hello,

I’m in a situation where my application needs to reach a remote server and grab some data from it. It only happens when a user submits a specific form on my website.

Here’s the flow:

  1. User submits form
  2. Reach remote server
  3. Get some data
  4. Use that data

I can trust remote server. So I was wondering if it would be ok to simply do the following:

  1. User submits form
  2. Redirect to remote server
  3. Remote server redirects to original server with data appended to url (query string)
  4. Use that data

Or would it be better to do the following:

  1. User submits form
  2. cUrl request server
  3. Get data
  4. Use that data

What are the advantages of each approach (cUrl vs redirects)?

:slight_smile:

Use the latter, the former is just ghetto.

Also I don’t know what kind of data is coming back, but at the minimum, using cURL means it won’t be as easy to mess with.

I think the latter would mean you could handle any failure to load the site/data better, and manage a time-out more gracefully.