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?
- WordPress Theme file editor – error with sleep() php function
- Disable RSS /feed/ endpoints on posts without disabling RSS overall
- Display fields as values in array from external SQL DB
- Only Show Link If div Exists
- How to put a variable in a instance in the widget
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Trying to establish connection to External Database
- How to create a form and display its content as table in admin panel?
- add_action shortcut?
- Passing the custom field values in the wp_get_current_user array function
- Using fwrite() and “a” appends multiple times instead of once
- How to output a PHP file values by shortcode?
- Showing content from one page on another
- How to style options page in dashboard?
- How to insert a single row to WP database table?
- Get date numerical and separate?
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- WSoD being caused by this piece of code
- Converting HTML Template to WordPress Theme
- Set the background to a default image if there isn’t a specified “featured image”
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Add a variable in functions.php and call it in single.php
- How to access global variable $menu inside a class function
- Calling directories to load in wordpress
- WordPress add post format support not working
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Image media upload metabox
- How to remove the cufon script from Dzonia Lite theme [closed]
- How to remove or change the “W” icon in “My Sites”?
- get a simple array of all of the term names that exist in all taxonomies
- Login/logout in header
- Namespace spl_autoload problem in WordPress admin
- How to display posts by current user in a drop down
- Logged in user ID as post ID
- How does WordPress insert Paragraphs in posts
- WordPress Access allowed to fewer pages till user logs in
- Linking text within textarea of custom meta box
- custom rss templete
- Show css depending on activity type in BuddyPress activity-loop [closed]
- only show container with next/prev links if they exist?
- How to combine wordpress_logged_in cookies in one cookie?
- Populate dropdown with Child Pages based on Parent Page chosen
- How can I remove a function that has been added to wordpress with add_filter?
- Unreadable pagination
- Change the WP Video Shortcode Output
- Show categories then when clicked on a category list all sub category and when clicked show all posts in that sub category
- How to put “Read more” link in Custom Excerpt inside p tag?
- Two Different Links for Same Product – WooCommerce [closed]
- ACF: how do I get the fields and its values of a specific group?
- How to store data from multiple forms using ajax and php
- How to control WordPress image metadata (using Imagick)?
- How to add seperate classes to no-search-result and found-search-result pages on wordrpess search – is_search()
- Get value from shortcode to do something
- My custom wp-admin php files stopped working
- PHP 8, AJAX mail form to function.php doesn’t work
- How do I add custom bulk actions to multiple custom post types?
- Error when adding excerpt to the content through functions.php
- Automatically adding new post categories to menu
- Add data attribute to each li in menu
- Get post id in a function when edit/add a post
- Making BuddyPress Activity Stream (Post Type) Featured Images Clickable [closed]
- How to check if a meta value has already been assigned to any user?
- How to complete two other input fields, completed the first
- Prev/Next child navigation for current page modifications?
- Adding rel tag to all external links
- How can I apply_filters from inside a function?
- function to assign user role based on a field from usermeta
- what is the best practice to add new field to an api route
- Call to undefined function wp() in wp-blog-header.php
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Use DOMDocument with ob_start breaks my HTML code
- Auto-update products after they were published – Woocommerce
- How to prevent WP_Query function from returning all posts when empty?
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- JS file work only in index page
- Display a specific category of products in shop page and disable code for specific actions
- Woocommerce related product text
- Cannot access wp-admin (wordpress dashboard)
- esc_html_e() is not translating string in wordpress [closed]
- Removing “wpautop” (auto tags) only on certain pages?