The problem is most likely with the address you are trying to fetch, and it is extremely unlikely it relates directly to your code.
You should check what url is being passed to file_get_contents to make sure it is the one you actually tried in the browser. If they are the same, it might relate to to other server doing different things based on user agent.
Side note: you are reinventing the wheel twice, Why don’t you use the WordPress RSS API or at least the HTTP API?
Update per comment:
if all you need is to parse a standard RSS feed, then you should consider using the fetch_feed function. This function fetches the feed, parses it and caches the result for 12 hours by default.
Related Posts:
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- Enqueue Javascript Correctly for 3.5
- WordPress if (is_page) translation on certain page
- Editing Category RSS Feeds
- remove wp floating submenu in wp dashboard
- Remove a div from RSS feed
- How to change menu labels
- WordPress admin-ajax.php
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- How to modify the default feed via a function
- Can I add the post featured image to a specific RSS feed?
- How to access all meta data for RSS feed?
- WordPress create custom XML RSS feed template
- Access to “My Site” is missing from the admin bar
- A custom RSS feed link, how do I modify the XML structure?
- Styling admin page rows in order of importance (checkboxes)
- admin-ajax.php loading many times
- How do I change the Go To Categories link in the term_updated_messages
- How to access admin menu labels and links on front-end?
- List of all theme customizer control types?
- Modify previous and next text from pagination links
- Shortcode putting html such as
- Calling a method from functions.php on a click of a button
- How to redirect users to custom lostpassword page?
- How to change featured content to a different tag in WordPress Twenty Fourteen?
- How do I create comment-reply-button using element not
- WordPress menu deletes when trying to add a hook
- Overriding a theme redux file in child theme
- Validate a users email address when using gmail to register
- How to check If Oembed is empty or not
- Making Quote Plugin more efficient
- allow subscribers to see private posts without plug in
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Show css depending on activity type in BuddyPress activity-loop [closed]
- Unreadable pagination
- Fatal error: Uncaught Error: Call to undefined function test()
- Cannot access wp-admin/wp-login.php (WordPress backend) anymore, what could be wrong?
- Return a numerical function value in Customizer controls
- How can I get the values of my WordPress $wpdb query in Jquery?
- Css loads very slow [closed]
- Show when user is online/offline in real time on user_profile.php
- theme_root returning a truncated URI
- Add class to group inner container
- Use .php file as page instead of wordpress page & template file?
- Illegal string offset in PHP function
- Find hours between post_date and post_date_gmt
- Run a code only on theme activation only during first activation
- Shortcode from a function not working
- Displaying text if post was within 5 hours
- Creating WordPress Shortcode with Variable
- Convert the_permalink() function output into string
- Adding a tag_ID column into Categories inside the admin dashboard?
- AJAX wp_insert_user WORKS but responds with “The site is not enabled”
- Add meta tags to a custom header
- get_current_site() is undefined
- Automatically Add Page Links to Nav Menu
- blank white page when post/update/change option etc
- Function sanitize_title() does not appear to be working
- How to Display a List of Child Pages For a Parent Page in WordPress
- writing an unique php function to be used on my website
- How to prevent a function from running based on host (ie web vs local)?
- Get date function not working
- How to remove/hide collapse menu for user/subscriber?
- How to implement __() function in my theme’s php file?
- How a HTML form can trigger a PHP function?
- WP custom posts: filter results to custom taxonomy tag that corresponds to user meta field
- Get current user id in function php
- Proper way to remove html code on child theme
- Trying to add Custom Post Type to this functions.php command
- Apply function.php filter only if url not has /amp/
- Preventing direct access to a page in WordPress
- Get custom field value from the function.php
- Non-blocking file_put_contents in function.php
- Display a custom name when the user has no name settle in his account
- Discount in the specific product title using keyword ( Woocoommerce )
- Modify post image in full size
- How to link all featured images to custom url in single.php for only non-logged-in users?
- Menu to the right of screen on desktop using Bootstrap 4
- custom post type column countdown
- Automatically refresh page if widget is added to page?
- Right way to display the_author_meta fields?
- Creating wordpress user registration form
- Add missing alt tag to featured images for “storefront” theme
- Load admin bar without wp_head or wp_footer [duplicate]
- My query keeps looping infinitely ! how to stop it?
- Highlight Single Page Ancestor
- Published custom posts missing
- Registration form not registering First and Last name
- Removing get_template_part in child theme
- PHP version or config prohibiting script from working properly
- How to get the rating value of each comment
- Functions.php file in a custom child theme messed up without backup
- How can I fix my pagination?
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How call WordPress shortcode inside function file
- strict custom php script on specific product category [closed]
- Add adjacent post function inside custom recent post function
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- How can I display a Divi content inside a modal based on an AJAX request
- How to Customize the Admin Sidebar Menu in WordPress Multisite Network by changing the backend code of the wp-admin code files?