php file_get_contents: failed to open stream when using variable for url

45
December 08, 2019, at 11:10 AM

xml where i am getting all the suburls to then scrap some things, i am getting all the suburls good but when i try this foreach i am getting the next error.

foreach($array as $item){
    $newItem = str_replace('https', 'http', $item);
    $xml_new = file_get_contents($newItem); 
    echo ($xml_new);
}

with this i am getting

file_get_contents(<?xml): failed to open stream

but if i do the file_get_contents('url') where the url is the same as the $newItem is working good

any advice where i could make it work the foreach?

READ ALSO
Can&#39;t retrieve data from database when using a PDO

Can't retrieve data from database when using a PDO

I'm having trouble getting data from the databaseThis is all done on localhost using WAMP

44
how to Reset Woocommerce earnings without reseting All Woocommerce plugin?

how to Reset Woocommerce earnings without reseting All Woocommerce plugin?

i created my new store with Woo commerce and when i was checking the pages of websites and checking the payments method (using cash on delivery) i did some orders

42
can client create table and control the number of columns in laravel and add / delete in this table [closed]

can client create table and control the number of columns in laravel and add / delete in this table [closed]

Want to improve this question? Update the question so it focuses on one problem only by editing this post

67
Email: [Firebase] Client access to your Cloud Firestore database expiring in X day(s)

Email: [Firebase] Client access to your Cloud Firestore database expiring in X day(s)

I got an email that indicates I was developing in "test mode", but that it left my database completely open to the internetThe default rules I initially accepted look like this:

48