smileydan88 Posted April 27, 2007 Share Posted April 27, 2007 Hello, I am new to PHP and SQL and am having a problem. I have an API that produces a webpage full of numbers, such as this: http://www.alipr.com/api-simpl.php?simplicity=1169721164.48509556 I need to somehow get those numbers seperated into timestamp and id and make them show as images. I know this is confusing but I can get the image to show if I can get the timestamp and ID seperated. I only need the top three images. Please let me know if this is confusing or you can help. --Dan Link to comment https://forums.phpfreaks.com/topic/49006-phphtml-question/ Share on other sites More sharing options...
sanfly Posted April 27, 2007 Share Posted April 27, 2007 First you need to read the entire file into an array using file() $array = file("path/to/file/myfile.txt"); The you need to use explode() to get the timestamps into seperate values Since the info we put into $array is in an array, then we need to use the first array value to do this step $data = explode(' ',$array[0]); Now you can access all your first three data points (remember arrays start at 0) $point1 = $data[0]; $point2 = $data[1]; $point3 = $data[2]; This code below may help you see how it all works. It prints out the arrays so you can see what Im talking about Substitute "test.php" for your file name <? $array = file("test.php"); print_r($array); echo "<br><br><br><br>"; $data = explode(' ',$array[0]); print_r($data); echo "<br><br><br><br>"; echo $data[0]; echo "<br><br>"; echo $data[1]; echo "<br><br>"; echo $data[2]; echo "<br><br>"; ?> Link to comment https://forums.phpfreaks.com/topic/49006-phphtml-question/#findComment-240048 Share on other sites More sharing options...
per1os Posted April 27, 2007 Share Posted April 27, 2007 http://us.php.net/xml That is what you want to look into. Link to comment https://forums.phpfreaks.com/topic/49006-phphtml-question/#findComment-240050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.