Jump to content

Recommended Posts

Hi all,

I've written a script to read from an external XML file, but every time I run the script, I get a different amount of information.  I've tried messing with (increasing/decreasing) the second parameter in fread() to no avail.  I cut out everything unnecessary to create a simple test file.  You can see the script running at: http://ariherstand.com/temp/test.php or just check out the code below:

<html>
<body>
<?php


$file = "http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml/future"; 
$fp = fopen($file, "r"); 
$data = fread($fp, 10000000); 
echo $data;
?>

</body>
</html>

 

I know it's not ArtistData (the people serving up the xml feed), because I can go to their site - http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml/future - and it gives the same amount of info every time I refresh.  Besides being sporadic, I also haven't had it give me the full amount of information yet.  There should be something like 16 separate shows.

Try this instead.

 

<?php
$data = file_get_contents("http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml/future"); 
echo $data;
?>

 

And see what gets returned. Also view the source of that test.php page you have, the xml data is there, the issue is you are using <html> tags etc instead of proper XML tags. This will cause issues of feeds not displaying right.

Try this instead.

 

<?php
$data = file_get_contents("http://feeds.artistdata.com/xml.shows/artist/AR-YX458DZO75EQACZ3/xml/future"); 
echo $data;
?>

 

Cool, that did the trick.  Thanks!

 

 

 

Also view the source of that test.php page you have, the xml data is there, the issue is you are using <html> tags etc instead of proper XML tags. This will cause issues of feeds not displaying right.

 

 

Yeah, I had been viewing the source but it was never giving me enough separate shows.  Your function did the trick, though.  Yay!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.