SOAP not working when I hook on "wp_loaded"
I can make SOAP calls from by example the woocommerce_payment_complete
hook or from the WP CLI.
If I make the exact same call from wp_loaded
I get the SOAP Error: failed to load external entity
Is it bad practice to hook on wp_loaded
? I understood that wordpress was fully loaded, I do this to receive callbacks from an external service but there's maybe a better way to do it? (I'm pretty new to Wordpress development).
add_action('wp_loaded', function() {
$uri = explode('?', $_SERVER['REQUEST_URI'])[0];
if ($uri == '/navision') {
$payload = file_get_contents('php://input');
_navision_callback_received($payload);
}
});
add_action('woocommerce_payment_complete', '_woocommerce_processing_order', 10, 1);
function _navision_callback_received($data) {
/* SOAP CALL ---- error */
}
function _woocommerce_processing_order($orderId) {
/* SOAP CALL ---- success */
}