Questions tagged [http-request]

Use it for questions about HTTP requests, sending and receiving requests, status codes and more.

39 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
1 answer
569 views

drupal_http_request() returns "Invalid JSON primitive"

I am developing a module for Drupal 7 which calls a remote API. I am using drupal_http_build_query(), drupal_http_request(), and drupal_json_decode(). My code is as follows $username = $form_state['...
Richard Luckhurst's user avatar
3 votes
0 answers
326 views

Site is down due to MySQL error but it returns 200/OK

A site I help administer was showing a uncaught exception page. Additional uncaught exception thrown while handling exception. PDOException: SQLSTATE[HY000] [2002] Can't connect to local MySQL ...
Joe Corneli's user avatar
2 votes
0 answers
60 views

How can I access nested data?

Im currently using Drupal's http client manager module to pull data from a json endpoint. I am having trouble getting this to work for a nested structure like this. { count: 2431 page_info: [] ...
tnum's user avatar
  • 21
2 votes
0 answers
92 views

Getting An AJAX http error occured when updating modules

I recently staring getting a "An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: http://192.168.1.20/alan_page/authorize.php?batch=1&id=67&op=do ...
Alan's user avatar
  • 121
1 vote
0 answers
85 views

Custom module routing issue

I've a custom module where I have create the following route: my.custom.route: path: /{someVariable}/my-module/test defaults: _controller: '\Drupal\my_module\Controller\...
Paulo's user avatar
  • 11
1 vote
1 answer
186 views

Use async with drupal_http_request()

I need to make an asynchronous call with drupal_http_request(). Is it possible?
user106028's user avatar
1 vote
1 answer
158 views

Convert Acquia Clear Varnish For One URL Curl Command to Drupal::httpClient()

I am trying to convert a command to php curl or Drupal::httpClient(). The original command Curl -k -X PURGE -H "X-Acquia-Purge:[site-name]" --compressed -H "Host: example.com" ...
Alaa Haddad's user avatar
1 vote
1 answer
140 views

RuntimeException when patch submission. Module Webform Rest

When i send a PATCH request to my site to /webform_rest/{webform_id}/submission/{sid}?_format=json with the body { "data":{ "sincronizado":1 } } or { "...
mcventur's user avatar
1 vote
1 answer
82 views

Decoupled Drupal - Security: files structure

I am running a Drupal 8.9.2 site as a content repository accessed via an Angular 8 app. So there is one administrator who uses the Drupal interface to write content / upload files eccc.... and ...
elenat82's user avatar
1 vote
0 answers
659 views

cant read current user in middleware

i am relatively new to drupal . thus i am trying to make an sso system work . i have this parent domain "domain.com" and the drupal site is running on sub.domain.com  . i can read the cookies and all ....
akramabdelrahman's user avatar
1 vote
1 answer
1k views

HTTP Client Manager $request->getStatusCode() == 200 return?

When I read this HTTP Client Manager docs on Drupal, I don't understand why it returns the $build when $request->getStatusCode() == 200, is that supposed to be not equal 200? I also copy and paste the ...
Jiang Zhan's user avatar
1 vote
1 answer
2k views

Setting exposed filter default value from query string

I have a view which show products and an exposed filter block (category, manufacturer, price). I want to set category default value from URL, like this: /browse-products/category-id though, I wrote ...
Wisamx's user avatar
  • 53
1 vote
0 answers
2k views

How to set GET param to current Request?

I created a service and it works as well. A piece of my code from "event_subscriber": public function addRequestAddValue(GetResponseEvent $event) { $request = $event->getRequest(); $request-&...
slivorezka's user avatar
1 vote
0 answers
625 views

Response object for Drupal HTTP Request

We are using the drupal_http_request function to send some data to salesforce. We've been told that one of the fields is being cut off and that they are receiving incomplete data. When I examine the ...
user2441356's user avatar
1 vote
0 answers
36 views

Question on Drupal and HTTP requests

I am using the drupal_http_request method and It seems to work well. When I use it, I send by POST from site A, a return URL (which would be site C) to site B that I am directing drupal to go to. So ...
Will's user avatar
  • 33
1 vote
1 answer
109 views

Omega theme showing 404 on iPhone

I have a site on my local server which is served by Apache using virtual hosts. I am using an omega sub-theme. On the desktop everything works fine. I try to browse to the site via the iPhone by ...
Stephen Burke's user avatar
0 votes
0 answers
80 views

Using StreamedResponse for AJAX?

I am looking for a way with a Form API form in Drupal to have an #ajax event on a form field. When submitted, this calls a remote API. How can I stream the response out to the screen without the ...
Kevin's user avatar
  • 27.5k
0 votes
0 answers
46 views

Specific CORS on a custom form POST request

I'm on D 9.3.x I have a custom form, e.g. my_module.my_form: path: 'custom-form-end-point' defaults: _title: 'Custom Form' _form: 'Drupal\my_module\Form\MyFormController' requirements: ...
Giuseppe's user avatar
  • 835
0 votes
0 answers
187 views

Troubleshooting Setting Cache Context to Session in Preprocess

My goal is to look for "webp" in the client HTTP_ACCEPT header in order to determine if I can serve WebP images. I chose this approach rather than using the WebP module because I thought it ...
user avatar
0 votes
1 answer
163 views

Get client credentials from Simple Oauth module

I am creating user authentification with Drupal 9 + NuxtJS. Using Simple Oauth module and create post requests to oauth/token with data const data = { grant_type: 'password', client_id: '', ...
Вадим Гаджимурадов's user avatar
0 votes
0 answers
51 views

Post Data to D7 from D9

How do I post data from Drupal 9 when a content is created, post data to Drupal 7 hosted in a different server to create node content. In Drupal7, I have enabled services module and created a resource ...
shablm's user avatar
  • 99
0 votes
0 answers
23 views

Delaying a Rules action until previous actions are complete

I'm making an HTTP request in an action which obviously takes some time. I want to use the response of that request in another action, but every time I get an error since the request hasn't completed ...
yuuuu's user avatar
  • 141
0 votes
1 answer
973 views

Cloudflare Clear Cache For One URL, Convert Curl Command to Drupal::httpClient() Or php

I am creating a custom module to clear caches on cloudflare for one url. The original curl command: curl -X POST "https://api.cloudflare.com/client/v4/zones/123456789/purge_cache" \ -H &...
Alaa Haddad's user avatar
0 votes
1 answer
469 views

Upload External File to Drupal File System

Situation I would like to be able to upload files programmatically from an external source to the drupal file system. I was thinking of making a RESTful API that allows me to save external files into ...
B. Cratty's user avatar
0 votes
0 answers
58 views

Why is the Downloading file size unknown despite Content-Length headers set with file size in bytes?

During Downloading files the size is unknown "0B" despite having set the "Content-Length" headers with the bytes (see $http_headers below) Content-Type (String, 15 characters ) application/zip ...
Markus's user avatar
  • 113
0 votes
0 answers
942 views

Guzzle POST HTTPS requests return 403 Forbidden only when called inside PHPUnit tests

On one side I have a remote Drupal 8 (8.8.1) served via HTTPS which has the following endpoint: MODULENAME.get_notify: path: 'MODULENAME/get-notify' defaults: _controller: '\Drupal\MODULENAME\...
Roger's user avatar
  • 208
0 votes
0 answers
309 views

How to Resolve CORB Issue using Drupal Docker Container

I'm running the latest version of the Drupal docker container. I'm trying to make a GET API call via Javascript and I'm receiving back CORB (cross-origin-read-blocking) errors in the Console when ...
jeffnaismith_design's user avatar
0 votes
0 answers
51 views

Help needed with ajax request from Jquery to callback function

I create the callback url 'swish_payment/request' in my hook_menu() function: function swish_payments_menu(){ $items['swish_payment/request'] = array( 'type' => MENU_CALLBACK, ...
TBJ's user avatar
  • 606
0 votes
1 answer
224 views

Get data from remote REST API (read only)

We use a remote service (not Drupal) to publish press releases and to show those releases in a remote newsroom. This remote service offers an API so we should be able to fetch and show the newsroom ...
TBJ's user avatar
  • 606
0 votes
0 answers
132 views

drupal_http_request as authenticated user during cron

I have a rule set up that runs during cron. Part of that rule is an action that is supposed to save a PDF (via Entity Print which only authenticated users can access) to my server. It works fine when ...
MrPeanut's user avatar
  • 383
0 votes
1 answer
31 views

POST from external source

I have external site that needs to POST my drupal site (it basically shares data). I need to take the POST data parse it and create a node from it. Is this possible? I have created a PHP file ...
Udders's user avatar
  • 103
0 votes
1 answer
26 views

500 error on one page in entire site only showing error "You are here" instead of administration content

this error seems to only affect one page in on the website, and nowhere else. Here is what it looks like: The watchdog reports do not show the issue, and I believe it to be a permission error or ...
A.Lopez's user avatar
0 votes
1 answer
328 views

The web service endpoint returned a "HTTP/1.1 403 Forbidden" response

There are 12 or so similar questions but not drupal related. Here is my site on a digitalocean droplet: http://104.236.27.226/ It is apache2 on ubuntu16 php7. I am using: 000-default.conf: ...
Casey Carnnia's user avatar
0 votes
0 answers
132 views

How to get HTTPS url to work with Drupal Iframe Module?

I want to get HTTPS urls working as iframes. Now only http URL's work. https://www.drupal.org/project/iframe Is there a way to do that?
Bruno  Vincent's user avatar
0 votes
1 answer
348 views

Access forbidden 403 to homepage but the rest of website working Drupal 7

I have Drupal 7 installed in localhost, with XAMPP, and it is a replica of a complete working site. I think I have configured everything ok as I can see all the site working nice, with its friendly ...
Cesar's user avatar
  • 46
0 votes
4 answers
10k views

"An AJAX HTTP error occurred.HTTP Result Code: 200"

I'm new to Drupal, and I'm working with a Drupal site that someone else wrote. From the admin menu, when I go to Structure -> Pages -> Edit Content -> Gear Menu -> Edit (or Settings), Drupal throws up ...
confusedbydrupal's user avatar
0 votes
2 answers
899 views

How to redirect the user to an external website with POST data?

I want to implement an offsite payment method and everything is going well except the fact that I can't find how to redirect the user to the offsite payment gateway after submitting the cart checkout ...
Sianurh's user avatar
-1 votes
1 answer
794 views

drupal_http_request give 400 response code for working url

I have major problem while getting response. I am using drupal_http_request to get the response but I get 400 as response though url given is working... I tried Curl Http Request module to overrride ...
Swapna Revankar's user avatar
-2 votes
1 answer
28 views

How to get multiple articles with specific ids via JSON:API in one request

how can I get multiple articles with specific ids in one request. I have tried lots of variations of https://website.com/jsonapi/node/article/aecc1a8b-b827-46a5-956b-16feb49e47c9 but without success. ...
Anatoli Asenov's user avatar