Jump to content

Using PEAR


PET

Recommended Posts

Well I use XAMPP witch also installs PEAR.

 

Now I want to use PEAR in a script that I'v placed into htdocs (as usual).

 

How do I call a PEAR script?

 

<?PHP
/**
* XML_Beautifier example 1
*
* This example displays the basic usage.
*
* @author	Stephan Schmidt <schst@php.net>
*/
error_reporting( E_ALL );

    require_once 'XML/Beautifier.php';
    $fmt = new XML_Beautifier();
    $result = $fmt->formatFile('test.xml', 'test2.xml');
    
    if (PEAR::isError($result)) {
        echo $result->getMessage();
        exit();
    }

    echo "<h3>Original file</h3>";
    echo "<pre>";
    echo htmlspecialchars(implode("",file('test.xml')));
    echo "</pre>";
        
    echo    "<br><br>";
    
    echo "<h3>Beautified file</h3>";
    echo "<pre>";
    echo htmlspecialchars(implode("",file('test2.xml')));
    echo "</pre>";
?> 

 

This is a small example I try to run wich ask's for 'XML/Beautifier.php', ofcourse I get this:

 

Warning: require_once(XML/Beautifier.php) [function.require-once]: failed to open stream: No such file or directory in C:\XAMPP\xampp\htdocs\example1.php on line 11

 

Fatal error: require_once() [function.require]: Failed opening required 'XML/Beautifier.php' (include_path='.;C:\XAMPP\xampp\Smarty\libs\') in C:\XAMPP\xampp\htdocs\example1.php on line 11

 

I guess I shoudn't copy the classes from PEAR into my htdocs directory... right? How to do it?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.