I want to send Client's IP address with WordPress's wp_remote_post() function. Target URL should recognize Client's IP address instead of Server's IP.
Is it possible?
I want to send Client's IP address with WordPress's wp_remote_post() function. Target URL should recognize Client's IP address instead of Server's IP.
Is it possible?
Depending on the REST service receiving the data. You could try one of the following:
Query params
$response = wp_remote_get( $url . '?client_ip=' . $_SERVER["REMOTE_ADDR"] );
Headers
$response = wp_remote_get( $url, [ 'headers' => [ 'client_ip' => $_SERVER[ "REMOTE_ADDR" ] ] );