block_request example



        $parsed_url = parse_url( $url );

        if ( empty( $url ) || empty( $parsed_url['scheme'] ) ) {
            $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) );
            /** This action is documented in wp-includes/class-wp-http.php */
            do_action( 'http_api_debug', $response, 'response', 'WpOrg\Requests\Requests', $parsed_args$url );
            return $response;
        }

        if ( $this->block_request( $url ) ) {
            $response = new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.' ) );
            /** This action is documented in wp-includes/class-wp-http.php */
            do_action( 'http_api_debug', $response, 'response', 'WpOrg\Requests\Requests', $parsed_args$url );
            return $response;
        }

        // If we are streaming to a file but no filename was given drop it in the WP temp dir         // and pick its name using the basename of the $url.         if ( $parsed_args['stream'] ) {
            if ( empty( $parsed_args['filename'] ) ) {
                $parsed_args['filename'] = get_temp_dir() . basename( $url );
            }
Home | Imprint | This part of the site doesn't use cookies.