Arquivos da categoria: WordPress

wp_remote_get debug hooks

function omniwp_wcte_display_api_curl( &$handle, $args, $url ) {

if ( false === strpos( $url, ‘https://api.ticketevolution.com/v9/’ ) )
return;

curl_setopt( $handle, CURLOPT_HTTPHEADER, array(
‘X-Signature: L9pBrEKzOtA7hTx3DqMV++pZRBvwQdQQ0Fwpk84t+wg=’,
‘X-Token: 53b043316ee369508295ee0cb9cca1ae’,
)
);
echo ‘<pre>omniwp_wcte_display_api_curl url
‘ .  print_r( $url, true ) . ‘</pre>’;
echo ‘<pre>omniwp_wcte_display_api_curl
‘ .  print_r( $args, true ) . ‘</pre>’;
}

add_action( ‘http_api_curl’, ‘omniwp_wcte_display_api_curl’, 10, 3 );

function omniwp_wcte_display_http_request_args( $args, $url ) {
echo ‘<pre>omniwp_wcte_display_http_request_args args
‘ .  print_r( $args, true ) . ‘</pre>’;
return $args;
}
//add_filter( ‘http_request_args’, ‘omniwp_wcte_display_http_request_args’, 10, 2 );

function omniwp_wcte_display_http_api_transport_args( $transport, $args, $url ) {
echo ‘<pre>omniwp_wcte_display_http_api_transport_args transport ' . print_r( $transport, 1 ) . '
‘ .  print_r( $args, true ) . ‘</pre>’;
return $transport;
}

//add_filter( ‘http_api_transports’, ‘omniwp_wcte_display_http_api_transport_args’, 10, 3 );

function omniwp_wcte_display_api_debug( $response, $context, $class, $args, $url ){
echo ‘<pre>omniwp_wcte_display_api_debug context
‘ .  print_r( $context, true ) . ‘</pre>’;
echo ‘<pre>omniwp_wcte_display_api_debug http args
‘ .  print_r( $args, true ) . ‘</pre>’;
}

//add_action( ‘http_api_debug’, ‘omniwp_wcte_display_api_debug’, 10, 5 );