array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => $params->toQueryString(), // Force the peer to validate (not needed in 5.6.0+, but still works 'verify_peer' => true, // Force the peer validation to use www.google.com $peer_key => 'www.google.com', ), ); $context = stream_context_create($options); $contents = file_get_contents(self::SITE_VERIFY_URL, false, $context); if ( ! $contents ) { $raw_response = wp_remote_post( self::SITE_VERIFY_URL, array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'headers' => array( "Content-type" => "application/x-www-form-urlencoded" ), 'body' => $params->toArray(), ) ); $contents = wp_remote_retrieve_body( $raw_response ); } return $contents; } }