Version: 1.00, by lebanon
Developer Last Online: Jan 2014
Category: Miscellaneous Hacks -
Version: 3.6.1
Rating:
Released: 09-23-2006
Last Update: Never
Installs: 76
No support by the author.
This is a quick vb-horoscopes feature to add to your forum.
I just made this and tested it on my forum, working fine as shown demo below
Requirements:
php fopen on
ADDED : IF fopen is not ON on your webserver , download the second zip file called gethoroscopes.php and replace the one in your cron folder with this one that uses Curl instead of fopen.
Installation :
-Upload the files to their respective locations
-Install the product using the VBulletin product manager
Your done !
You can test your script directly by going to your scheduled task
and using "RUN NOW" you should see the script output and then you
can go check your page at http://urforum/dailyhoroscopes.php
License :
- Your are allowed to query our website using the cronjob once everyday
Leave on default installation and you will not be breaking any rule, or only change the HOUR and MINUTE of runtime.
- You can freely modify the template the way you wish, all you need is
to leave the $result reference where you want it for the script to function
I will also appreciate if you share us with your modified template !
- You are required to keep the copyright text in your template, however if
you prefer to remove it, you can only do that after contacting me and recieving permission to do so ( free of charge ofcourse )
A little modified code of the cronjob that parses the horoscopes i made it so u can have a function gethoroscope(signname)
If u want u can replace your gethoroscopes.php with that and itll work fine.
PHP Code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
// ########################################################################
// ######################### START MAIN SCRIPT AND WRITE TO TXT ###########
// ########################################################################
$signs = array("aries","Taurus","gemini","cancer","leo","virgo","libra","scorpio","sagi","capricorn","aquarius","pisces");
function gethoroscope($sign) {
$url = "http://www.tchatting.com/horoscopes/".$sign.".php";
@$string = implode("", file("$url"));
//$string = str_replace("\n","",$string);
$string = trim($string);
$filename = './dailyhoroscopes/'.$sign.'.txt';
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'w+')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $string) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($string) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
I had to CHMOD all the text files in forums/dailyhoroscopes before it would work... which means I hit your server three times in one day before I figured it out.
I had to CHMOD all the text files in forums/dailyhoroscopes before it would work... which means I hit your server three times in one day before I figured it out.
Sorry i have not mentioned any chmoding , because by default webservers would accept php read/write commands owned by user to his own user directories unless further restrictions applied from your host such as in your case !
Ill add a note for that ! thank you for your note
As for translations , well , the feeds i recieve are in english, ill try to setup a translator using some service like google or bablefish maybe all i can think of now , because i dont imagine daily translation would be easy unless automatic,.
As for translations , well , the feeds i recieve are in english, ill try to setup a translator using some service like google or bablefish maybe all i can think of now , because i dont imagine daily translation would be easy unless automatic,.
So we would be fetching a feed from another feed? Is there a way so we can program this to fetch any FEED we want?