help needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

help needed

Post by SidewinderX »

A friend of mine built me a little script, i cant seem to get it to work (it only displays a white screen)

here is the script source

Code: Select all

<?php
function <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>() {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://nw4.novaworld.net/NWBanned.dll');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies');
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
}
function getbannedcookie() {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://nw4.novaworld.net/NWBanned.dll?success=bhd_6_banned.htm&failure=bhd_6_main.htm&relay=bhd_6_relay.htm&msgbase=bhd_6_msg.htm&nodb=bhd_6_nodb.htm&pfid=26');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies');
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        $result = curl_exec($ch);
        curl_close($ch);
}
function parseit($file) {
        $file = explode("\n", $file);
        foreach ($file as $line) {
                if (preg_match('/<TR><TD>(.*)<\/TD><TD>(.*)<\/TD><\/TR>/', $line)) {
                        $line = preg_replace('/<TR><TD>(.*)<\/TD><TD>(.*)<\/TD><\/TR>/', 'User: \\1  Banned on:\\2', $line);
                        echo $line."\n";
                }
        }
}
getbannedcookie();
parseit(<span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>());
?>

here is the actual script hosting on my server(just a white screen)
http://www.extreme-hq.com/stats/BANNED/index.php

here is my phpinfo (curl is enabled)
http://www.extreme-hq.com/stats/BANNED/phpinfo.php

it should display a bunch of names and dates but it dosnt, it works for my friend and he dosnt know why it dosnt work for me so does anyone have any idea?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

might be that curl cannot create the cookie jar files.. ?
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

how could i fix the script so it would work?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

can you confirm that the cookie files aren't being created? It'd likely be a permissions "issue" with the folder you are running it in...
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

ah yes, the folder wasnt allowing the creation of cookies because the permissions werent allowing it to write.

thanks
Post Reply