• I am hosted on dreamhost, and recently they stopped supporting the include function. Dreamhost gave me an alternative, but I don’t know how to use it, here is the email they sent me regarding the problem:

    ————————————
    yes we apologize this has been disabled on all of our hosting servers. a
    customer has written a work around for this problem, it can be found
    here..

    http://wiki.dreamhost.com/index.php/CURL
    ————————————-

    I’m not sure how to use this alternative, and how to change my current script. I believe this part of the script might be what needs changing:

    <? require(‘./wp-blog-header.php’); $mode = $_GET[‘z’]; ?>

    Does anyone have any ideas 😉

    Right now, when I use the Z function, this is what I get:

    code
    Warning: main(): URL file-access is disabled in the server configuration in /home/.calzt/slickmx0/domain.net/index.php on line 518

    Warning: main(http://domain.net/page.php): failed to open stream: no suitable wrapper could be found in /home/.calzt/slickmx0/domain.net/index.php on line 518

    Warning: main(): Failed opening ‘http://domain.net/page.php&#8217; for inclusion (include_path=’.:/usr/local/lib/php’) in /home/.calzt/slickmx0/domain.net/index.php on line 518code

    Thankyou very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • WTF is “z function”? Is this a cheap trick to get visitors to your ‘naked-women-site’???

    they didn’t stop supporting the include function. They stopped supporting the include function with url’s, like:

    include('http://site.com/file.php')

    But local paths still work, like:

    include('./file.php') or
    include('/home/foo/bar/file.php')

    Note the above applies to require() as well. And the above is my understanding of that post.

    Here is a function I use to get file contents using curl:


    function get_file($url)
    {
    # check for curl...
    if ( !extension_loaded('curl') )
    die('Curl is not installed.');

    # initiate curl session...
    $ch = curl_init($url) or die('Curl failed to Initiate.');

    # set curl options...
    curl_setopt( $ch, CURLOPT_HEADER, 0 );
    curl_setopt( $ch, CURLOPT_HTTPGET, 1 );
    curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
    curl_setopt( $ch, CURLOPT_TIMEOUT, 15);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );

    # execute curl commands...
    $curl_result = curl_exec( $ch ) or die('Curl failed to execute GET.');
    curl_close($ch);

    return $curl_result;
    }

    So if you wanted to get the contents of a file on another site, you would do:


    $my_file = get_file('http://othersite.com/file.ext');
    echo $my_file;

    Moderator James Huff

    (@macmanx)

    If you haven’t upgraded to WordPress v1.5.1.2 yet, do so now.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘My Z function is not working, please help’ is closed to new replies.