You can use wp_remote_get or/and wp_remote_retrieve_body functions to get HTTP response
Retrieve the raw response from the HTTP request using the GET method. Results include HTTP headers and content. codex here
$response = wp_remote_get( $url, $args );
Retrieves the body of an already retrieved HTTP request. Codex
$the_body = wp_remote_retrieve_body( wp_remote_get('http://example.com') );
Related Posts:
- Sticky Posts exceed posts per page limit
- Theres a way to use $query->set(‘tax_query’ in pre_get_posts filter?
- Modify Taxonomy pages to exclude items in child taxonomies
- Obliterate the main query and replace it
- Post injection – how to exclude the original post
- Adding meta_key via pre_get_posts causes navigation to disappear
- Sorting posts that has a meta value first then the rest of the posts
- pre_get_posts on a page
- How pre_get_posts filter by roles in WP Admin
- Weird problem with pre_get_posts and $query->is_page()
- Why is ‘pre_get_posts’ having no effect?
- Date Query to Pull Current and Future Posts
- pre_get_posts all posts and custom post type with certain tag
- Using Sessions to Filter Posts – bad thing?
- pre_get_posts and the blog page
- Archive by custom post type and custom date field
- pre_get_post filter returns results when there should not be
- Trying to exclude first 5 posts from the first page on the homepage
- Exclude a WordPress post from pre_get_posts if a field is null
- Why the ‘date_query’ is not working in ‘pre_get_posts’ hook?
- Only show certain post types in recent posts widget
- pre_get_posts for exclude category
- pre_get_posts: using tax_query only for certain post type
- pre_get_posts dont firing… Anybody knows whats the wrong with my code?
- Restrict Search Query To After Specific Date
- WP_Error not displaying errors
- Show all posts even if URL points to a single one
- How to achieve post_status__not_in?
- Ordering by meta_key
- Using a pre_get_posts filter to search for multiple strings on all meta values
- Removing taxonomy query by pre_get_posts
- Using different parameters for different queries with pre get posts in functions.php
- how to restrict posts_request filter to the main query only
- Automatically applying a pre_get_posts filter for child categories only
- How to override a query and display specific page by ID?
- pre_get_posts variables
- Another query in pre_get_post cause memory issue
- pre_get_posts having no effect on my category archive
- pre_get_posts returns non property object when using posts__not_in
- Override tax_query with pre_get_posts to include other term_ids on a single category
- $query->is_main_query() is causing query’s tax_query to be ignored
- Menu disappears when meta_key changed [closed]
- pre_get_posts with multiple queries
- How to show the last and newest modified post in a custom category?
- Altering the main query using get_post_meta() in pre_get_posts
- Why query by specific date with variables doesn’t return same result that with harcoded integers?
- Sort WordPress Archive by multiple oderby arguments in pre_get_posts action
- Exclude post type with pre_get_posts?
- Exclude page by title for non admins
- problem with setting tax_query in pre_get_posts
- Problem ID to exclude specific posts from category
- Modify Taxonomy pages to exclude items in child taxonomies
- Modify author archive query to combine two queries
- Change post order on archive to be displayed by most commented being ignored by theme
- Complex query using pre_get_posts
- Super confusing ‘pre_get_posts’ behavior with $query->set
- Having trouble with settings terms as array in pre_get_posts
- Override main query for page template
- Querying custom taxonomy on category-specific page is overwritten by function
- Insert a variable in pre_get_posts
- Extend taxonomy term page with other posts
- Set a custom number of posts on the first page
- Why does this query not SELECT post IDs like a normal query would?
- Please ensure me that I’m not crazy using the pre_get_posts [closed]
- How to pass >= condition filter to my year custom tax_query
- What is the proper way to use pre_get_post?
- pre_get_posts has php notice when not on CPT archive
- Duplicating event posts in wordpress
- Sort on meta value but include posts that don’t have one
- Using pre_get_posts to set posts per page, how do I?
- filter search result with custom post type meta key
- Modify query in pre_get_posts action is messing up my nav menu
- Why am I getting a 404 on anything past page 1 of my query?
- pre_get_posts on custom post type
- Include posts from feature category in pre_get_posts
- Single meta_query query using OR instead of AND in request’s WHERE statement
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- How to choose between hooking into per_get_posts or into parse_query
- new WP_Query to get max price meta value not working
- Multiple meta_values in the pre_get_posts filter?
- Removing “s” from search with custom parameters
- Filter pre_get_posts does not modify Mine/All/Pending
- Shouldn’t I be able to modify the main query by this filter?
- Hide elements outside loop based on query
- Change post order by meta key, per post basis
- Custom tax_query filter not working for Woocommerce product categories
- WP_Query articles order by offset in collumns
- Modified home page query does not yield expected results
- meta_query Array
- order posts by a secondary query that counts items
- Display Specific Posts at Start of Loop
- Why is pre_get_posts hook invoked multiple times?
- Get First Post content and edit it using pre_get_posts (or similar?!)
- pre_get_posts gives 404 error on Custom Post
- Sort posts by meta value with get method
- using posts_where for meta data on pre_get_posts
- excludeCat function reverses order of blog posts
- Using $seed on a custom post type for randomly displayed posts
- How do I sort post listing by child post count?
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)