How to log outgoing HTTP requests from WordPress?

Procédure

  

Service concerned: WordPress
Concerned panel: WordPress dashboard
Level: intermediate

When a WordPress site communicates with an external service, it makes an HTTP request. These communications are notably used to check for updates, contact an API, or synchronize a plugin.

The Log HTTP Requests plugin lets you record these requests in order to identify an error or an abnormally slow communication.

This plugin records outgoing requests made using the WordPress HTTP API. It does not allow you to view visits received by your site or all of the network traffic for your hosting account.

Before you begin

You must have a WordPress account authorized to install and activate plugins.

You must also be able to reproduce the action to analyze, for example submitting a form, a synchronization, a check for updates, or connecting to an external service.

Install the Log HTTP Requests plugin

  1. Log in to your WordPress site dashboard.
  2. In the left-hand menu, click Plugins, then Add Plugin.
    How to log outgoing HTTP requests from WordPress?
  3. Search for the Log HTTP Requests plugin using the search field.
    How to log outgoing HTTP requests from WordPress?
  4. Make sure the plugin displayed has that name, then click Install Now.
  5. Once installation is complete, click Activate.

Recording of new HTTP requests begins as soon as the plugin is activated.

Display the recorded requests

In the left-hand WordPress menu, click Tools, then Log HTTP Requests.

How to log outgoing HTTP requests from WordPress?

The table shows the main information for each communication:

  • URL: the address of the contacted service;
  • Status: the HTTP response code returned by the service;
  • Runtime: the duration of the communication, expressed in seconds;
  • Date Added: the date and time when the request was recorded.

How to log outgoing HTTP requests from WordPress?

Click a row to display the details of the request sent and the response received.

How to log outgoing HTTP requests from WordPress?

The interface also provides the Refresh button to update the list and Clear log to delete the recorded entries.

Reproduce the problem to analyze

To identify a specific request:

  1. Open the Tools > Log HTTP Requests page.
  2. You can click Clear log to start with an empty list. Only do this if you no longer need the entries already present.
  3. Go back to your site and reproduce the action concerned: submit the form, restart the synchronization, or use the feature that is causing the problem.
  4. Return to Tools > Log HTTP Requests, then click Refresh.
  5. Identify the new entry using its date, time, and the address of the contacted service.

A code between 200 and 299 generally indicates that the remote server responded correctly. A code starting with 4 or 5 usually indicates a refused request or an error encountered by the remote service.

A high execution time may indicate a slow communication. However, there is no maximum duration that applies in all situations: the result must be compared with the usual behavior of the service concerned.

Request details may contain personal data, an API key, an access token, or other confidential information. Always check their contents before sending a screenshot or a copy of the log.

Check that recording is working

After reproducing the action to analyze and refreshing the log, a new line should appear with the address of the contacted service, its response code, and the duration of the communication.

The new request appears in the log: the plugin is working and you can view its details to continue the diagnosis.

Once the diagnosis is complete, click Clear log if you want to delete the recorded entries. You can then deactivate and delete the plugin if you no longer need it.

Common issues

I don't see the “Add Plugin” button

Your WordPress account probably does not have the necessary permissions. Log in with an administrator account.

On a WordPress multisite network, plugin installation may be restricted to the network super administrator.

I can't find the plugin in the “Settings” menu

The plugin is accessible from Tools > Log HTTP Requests and not from the Settings menu.

No new request appears

Make sure the plugin is activated, then reproduce the action again before clicking Refresh.

Some communications do not go through the WordPress HTTP API. They cannot therefore be recorded by this plugin.

The log contains too many requests

Click Clear log, reproduce only the action to analyze, then immediately click Refresh. You will then be able to more easily identify the communication you are looking for.

The status shows 200, but the feature does not work

Code 200 confirms that the remote server responded, but its response may still contain an error specific to the service or application.

Click the relevant line and consult the Response section to inspect the response content.

help.lws.net/a/1302
Was this article helpful?

Yes

No

Read 15 010 times

Thank you! Feel free to ask questions about our documentation if you would like more information, and help us improve it.

Similar articles

A question about this article?

Ask the LWS team and the community. Answers are published after moderation.

Ask the LWS team and its community a question

GDPR: Controller: LWS-Ligne Web Services. Purpose: moderation and public publication of your question, possible notification of an answer. Legal basis: consent (Art. 6(1)(a) GDPR). Email retention: 90 days after notification, 12 months maximum without an answer. To exercise your rights, see the GDPR section of our Terms and Conditions.