Posts tagged files
PHP READING FILES SCRIPT PROBLEM?
Jan 26th
Question by :
PHP Reading files script problem?
I am having trouble with my PHP classes and was hoping someone could help me complete this script because it has me beat. I realize that this is suppose to be very basic, I am just having a very difficult time with it.
So basically, I need to
Read the file line by line, and use the explode and list functions to extract the category, rating, URL, and description. Use that information to write out a web page that contains each link and description, such as the following:
Maps
hopstop.com – A good way to find your way from here to there in major cities.
News
chicagotribune.com – The on the web version of the Chicago Tribune newspaper
Maps
mapquest.com – Find an address on a map or get directions from one place to another. ‘
At the moment I have this, ( I know that the explode command has to be in the wrong place I just dont know what I am missing.
My text file I am reading is named results.txt and everything that depends on it is in the correct place.
An example of the text it has is.
Random|3|google.com|Search Engine
Humor|9|whiteninjacomics.com|The adventures of White Ninja.
Games|5|wowhead.com|For all your WoW needs
Science|9|www.blender3d.com|A free open-source 3d graphics program!
News|8|digg.com|tech news
Random|1|myspace.com|Laugh at em.
The first field being the category the second being the rating and the third is the actual URL.
< ?php
$ filename = "../write/results.txt";
print "
Results.txt”;
if(($ fp=fopen($ filename,”r”))===false)
print(“Couldnt open the file”);
else
{
$ line = fgets($ fp);
while (!feof($ fp))
{
print htmlentities($ line).’
‘;
$ line = fgets($ fp);
}
fclose($ fp);
}
print “
“;
$ line=”games|9|http://www.gamefaqs.com”;
$ a = explode(“|”,$ line);
list($ Category,$ Rating,$ URL) = $ a;
print(“$ Category,$ Rating,$ URL
“);
?>
That really Helped thanks!
Do you know how I would be able to split the data up into their categories and then have them listed by rank ex:
Also how would I make the URLs actual links?
Maps
1 mapquest.com – Find an address on a map or get directions from one place to another.
2 hopstop.com – A good way to find your way from here to there in major cities.
News
5 chicagotribune.com – The on the web version of the Chicago Tribune newspaper
etc.
Read More >>
ARE THERE ANY ONLINE BACKUP PRODUCTS THAT ALLOW ONE TO ACCESS FILES REMOTELY WITH SEARCH CAPABILITY AS WELL?
Oct 28th
Question by Addicted to Yahoo! Answers:
Are there any on the web backup products that grant one to access files remotely with search ability as well?
I’m looking for a reputable on the web backup service which will grant me to access my files from anywhere and even search for documents, too, in a built in search engine.
Read More >>
HOW DO I CREATE A SIMPLE SEARCH ENGINE FOR PDF FILES IN A FEW SUBFOLDERS?
Jun 25th

Question by Joseph G:
How do i create a easy search engine for pdf files in a few subfolders?
I just want a search window that pulls up files.Not web based at all, though a browser based window is fine. I need to be able to pull up a specific file which is named by work order number.
I have all the files in a network older / subfolders. I need to just have a browser page with a search box that anyone has access to. When they type in the the work order number, a link to the file should pop up. Any scripting language is fine but if you know something that is easier then i want to know about it. I need the cheapest simplest way to do this. thanks.
Read More >>
PHP READING FILES SCRIPT PROBLEM?
Jul 19th
I am having trouble with my PHP classes and was hoping someone could help me complete this script because it has me beat. I realize that this is suppose to be very basic, I am just having a very difficult time with it.
So basically, I need to
Read the file line by line, and use the explode and list functions to extract the category, rating, URL, and description. Use that information to write out a web page that contains each link and description, such as the following:
Maps
hopstop.com – A good way to find your way from here to there in major cities.
News
chicagotribune.com – The on the web version of the Chicago Tribune newspaper
Maps
mapquest.com – Find an address on a map or get directions from one place to another. ‘
At the moment I have this, ( I know that the explode command has to be in the wrong place I just dont know what I am missing.
My text file I am reading is named results.txt and everything that depends on it is in the correct place.
An example of the text it has is.
Random|3|google.com|Search Engine
Humor|9|whiteninjacomics.com|The adventures of White Ninja.
Games|5|wowhead.com|For all your WoW needs
Science|9|www.blender3d.com|A free open-source 3d graphics program!
News|8|digg.com|tech news
Random|1|myspace.com|Laugh at em.
The first field being the category the second being the rating and the third is the actual URL.
< ?php
$filename = "../write/results.txt";
print "
Results.txt”;
if(($fp=fopen($filename,”r”))===false)
print(“Couldnt open the file”);
else
{
$line = fgets($fp);
while (!feof($fp))
{
print htmlentities($line).’
‘;
$line = fgets($fp);
}
fclose($fp);
}
print “
“;
$line=”games|9|http://www.gamefaqs.com”;
$a = explode(“|”,$line);
list($Category,$Rating,$URL) = $a;
print(“$Category,$Rating,$URL
“);
?>
That really Helped thanks!
Do you know how I would be able to split the data up into their categories and then have them listed by rank ex:
Also how would I make the URLs actual links?
Maps
1 mapquest.com – Find an address on a map or get directions from one place to another.
2 hopstop.com – A good way to find your way from here to there in major cities.
News
5 chicagotribune.com – The on the web version of the Chicago Tribune newspaper
etc.
Read More >>
ARE THERE ANY ONLINE BACKUP PRODUCTS THAT ALLOW ONE TO ACCESS FILES REMOTELY WITH SEARCH CAPABILITY AS WELL?
May 29th
I’m looking for a reputable on the web backup service which will grant me to access my files from anywhere and even search for documents, too, in a built in search engine.
Read More >>
HOW DO I CREATE A SIMPLE SEARCH ENGINE FOR PDF FILES IN A FEW SUBFOLDERS?
Apr 8th
I just want a search window that pulls up files.Not web based at all, though a browser based window is fine. I need to be able to pull up a specific file which is named by work order number.
I have all the files in a network older / subfolders. I need to just have a browser page with a search box that anyone has access to. When they type in the the work order number, a link to the file should pop up. Any scripting language is fine but if you know something that is easier then i want to know about it. I need the cheapest simplest way to do this. thanks.
Read More >>