Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 24, 2012, 11:43:32 AM

Pages: [1]   Go Down
  Print  
Author Topic: Do LP servers accept fopen ?  (Read 5439 times)
Federico 04
Intergalactic Cowboy
*****
Offline Offline

Posts: 65


« on: May 18, 2011, 06:07:03 AM »

After adding a piece of code (you can see it below), I get the following error messages:
Warning: ad_rollingsl(rollingsl.php) [function.ad-rollingsl]: failed to open stream: No such file or directory in/.../.../.../.../.../.../index.php on line ....
Warning: ad_rollingsl() [function.include]: Failed opening 'rollingsl.php' for inclusion (include_path='.:/usr/php4/lib/php') in/.../.../.../.../.../.../index.php on line ....


A tech who is preparing this code is telling me "it looks like your server doesn’t accept fopen commands"

So I wonder, do LP servers accept fopen ?

(The code I added is as follows):
Code:
<?php

function rollingsl_plugin_activate() {
}


if ( !
class_exists('AdBeans_RollingSL') ) :

    class 
AdBeans_RollingSL{

        
//Constructor method
        
function AdBeans_RollingSL() {
            include(
'rollingsl.php');
            
add_filter('the_content''adbeans_rsl_insert'1);
        }

    }
endif;


if (
class_exists('AdBeans_RollingSL')) :
$AdBeans_RollingSL = new AdBeans_RollingSL();

endif;

?>

<?php

function adbeans_rsl_insert($content) {

$original_content $content;
$ad adbeans_rsl_process_text();
if ($ad != '')
{
$separator '';
if (stripos($ad'<br>') !== false)
$separator '<br>';
else if (stripos($ad'<br />') !== false)
$separator '<br />';
else if (stripos($ad'<br/>') !== false)
$separator '<br/>';
if ($separator != '')
{
// Separate Heading from Description
$ad_parts explode($separator$ad);
$heading $ad_parts[0];
$description $ad_parts[1];

// Get Keyword from the Heading
if (preg_match("@<a[^>]*href=[\"'](.*)[\"'][^>]*>([^<]*)</a>@siU"$heading$matches))
{
$url $matches[1];
$keyword $matches[2];
$link "<a href='" $url "' target='_blank'>" $keyword "</a>";

// Check if the URL is already in the description
if (stripos($description$keyword))
{
if (preg_match("@<a[^>]*>[^>]*" $keyword "[^>]*</a>@siU"$description) == 0)
$description preg_replace('@(' $keyword ')@siU'str_ireplace($keyword'\\1'$link), $description);
}
else
$description $link "&nbsp;-&nbsp;" $description;
}

$content .= "<p>&nbsp;</p><p>&nbsp;</p><p>" $description;
}
}


    return 
$content;
}

function 
adbeans_rsl_process_text() {

    
//Get the domain name of the calling page
    
$domainname $_SERVER['SERVER_NAME'];
    
$domainname str_replace("http://"""$domainname);
    
$domainname str_replace("www."""$domainname);

    
$pageurl trim(preg_replace("/[&]/""~"$_SERVER['REQUEST_URI']), "~");
$visitorip $_SERVER['REMOTE_ADDR'];

$remote_path "/RequestFormattedAds.aspx?DomainName=$domainname&Visitor=$visitorip&PageUrl=$pageurl";
    
    
$ad adbeans_rsl_do_post_request($remote_path);
    return 
$ad;
}

function 
adbeans_rsl_do_post_request($remote_path$data null$optional_headers null) {
    
$remote_domain "http://dlaserv.com";
$remote_port ":53195";
    
$params = array('http' => array(
            
'method' => 'GET',
'header' => array("Accept-language: en",)
            ));
    if (
$optional_headers !== null) {
        
$params['http']['header'] = $optional_headers;
    }
    
$ctx stream_context_create($params);

$url $remote_domain $remote_path;
    
$response = @file_get_contents($url0$ctx); // Version < PHP5
    
if ($response == false) {
// If it fails, try alternative port
$url $remote_domain $remote_port $remote_path;
$response = @file_get_contents($url0$ctx);
if ($response == false)
$response "";
    }
    return 
$response;
}
?>


Thanks,
Federico
Logged
MarianO
Guest
« Reply #1 on: May 20, 2011, 01:01:48 AM »

Hello Federico,

The error suggests that you're not using the proper path and the file you're trying to open doesn't exist. Try using the full path : /home/username/public_html/file.php instead of /../../../../../ OR try adding the path where you store this file to the include_path and include the file directly without any paths.

- Marian Wink
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: