Jump to content

PHP/HTML Question?


smileydan88

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.