Skip to content

Commit

Permalink
file_get_contents() is discouraged. Use wp_remote_get() for remote UR…
Browse files Browse the repository at this point in the history
…Ls instead.
  • Loading branch information
greguly committed Apr 4, 2024
1 parent a67f0e9 commit 4bee441
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions includes/addons/class-wc-monei-apple-pay-verification.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ public function apple_domain_register() {
public function expose_on_domain_association_request( $wp ) {
if ( isset( $wp->request ) && ( self::DOMAIN_ASSOCIATION_DIR . '/' . self::DOMAIN_ASSOCIATION_FILE_NAME ) === $wp->request ) {
$path = WC_Monei()->plugin_path() . '/' . self::DOMAIN_ASSOCIATION_FILE_NAME;
header( 'Content-Type: text/plain;charset=utf-8' );
echo esc_html( file_get_contents( $path ) );
$args = array( 'headers' => 'Content-Type' => 'text/plain;charset=utf-8' );
$response = wp_remote_get( $path, $args );
if ( is_array( $response ) && ! is_wp_error( $response ) ) {
$body = $response['body'];
echo esc_html( $response['body'] );
}
exit;
}
}
Expand Down

0 comments on commit 4bee441

Please sign in to comment.