2

I have a Drupal 8 site with a form that I have to submit to another server using the REST protocol.

I have the following information.

  • server address
  • server port
  • form data

I want to submit that information to the other server.

Is there any function I can use in Drupal 8?

1 Answer 1

5

Because of the new Proudly Found Elsewhere standard, Drupal doesn't have its own client.

It does however include Guzzle, a well respected library. You can use that to make your REST calls, or of course include and use another library if you wish.

You can get to the Guzzle client in a default Drupal 8 install through the http_client service:

$httpClient = \Drupal::httpClient();

And the docs for Guzzle are here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.