FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Remote php file access and reading





Zackster
Ok well im busy coding a web site, its a link exchange web site that works by rather having every site display a link randomly selected from the link text file and it was working perfectly and then when i uploaded it the random link wasn't displayed at but the second static link did display and i cant seem to understand what is going on so my question is this... When calling a php file from a remote server should i use an echo statement to print the text or should i on the server not hosting the file use the file_get_contents statement or is there a better way?
Diablosblizz
You should be using MySQL for the links. MySQL beats .txt entries all the time. It's much easier to randomly select a link from a MySQL database then a text file. Below are some sites that will help you to start using MySQL. Trust me, it's worth it.

http://www.tizag.com/mysqlTutorial/
http://www.devshed.com/c/a/MySQL/Beginning-MySQL-Tutorial/

I'd go with the first one, as it classifies, while making it easy to read, information better. The best thing is that if you are using Frihost you have MySQL free of charge!

Good luck.
rvec
I think the best way would be to use curl to get the contents of the file and then parse it.
Zackster
Ok wel the thing is i am purposefully trying not to use non php and simple methods and databases. MySQL is way to easy to break into and write to the database and the scripts are under 30kb in total and MYSQL would enlarge it. But thanks for the advice... The cURL idea i rather did like but for this project i cant use it.
rvec
mysql isn't that easy to hack in to. If you have a 10char long password and a 10char long username the hacker would need a lot of luck to get in.

Mysql might enlarge it, but it would speed it up and make it easier to work with.

I don't really understand what you exactly want, but file_get_contents is slow.
Zackster
Thanks for all the help I finally got the site to work properly and three other sites as well... I was making a mistake with the .htaccess file and that was preventing the site from functioning correctly. I uploaded the .htaccess in binary mode by mistake.... No wonder the entire script was dieing and moaning. Embarassed

Thanks to everyone! Very Happy
Related topics
.htaccess tutorial
PHP Toturail
pay attition to the new virus Backdoor.Nibu.K
Cron jobs - running a php file
[PHP doubt]Knowing the directory location of PHP file
PHP Test File
is there any way to trigger a .php file without refreshing?
Uploading a .php file! NEED HELP thanks
User Viewing A PHP File
send variable from php tp php file
Limiting php file functions with .htaccess
including javascript in php file
Hide PHP file extension
[TuT]JOOMLA Installation Guide(Easiest Way)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.