I am going to a url, which is just an rss feed, and now I would like to parse the code to return certain bits of information (image urls). I've gotten as far as finding where my information starts but I can not figure out how to read until my delimiting character; which is a ". I would ultimately like to the image urls saved to a text file that my iphone app can reference.
Basically, I want to go to the url.. scan the html code for the image urls that are posted, and return it to a text file.
Here is my current code
<?php
$url = 'http://www.actionsportsinc.com/p200285048/recent.rss';
$data = file_get_contents( $url );
// just a test to compare with RSS to see whats being pulled
$file = 'iphoneApp.txt';
// Write the contents back to the file
file_put_contents($file, $data);
if(strpos($data, '<media:content url="') !== FALSE)
{
$url = "";
while (! feof($file) && (fgetc($file) != '"')) {
$url = $url . fgetc($file);
}
echo $url; // just trying to print out one url right now to make sure it is actually working... would like to scan entire rss until EOF
}
?>
Here is an example of the rss looks like
<media:content url="http://www.actionsportsinc.com/img/s12/v173/p468059272-4.jpg" type="image/jpeg" medium="image" width="800" height="533"/>
<media:title>D1411HMSF134189JRN</media:title>
I would appreciate any suggestions you all may have. Thank you!