I made a web application which allow the user to create an image dynamically in JavaScript.  

It use jQuery to allow the user to place div, resize them and drag them into a `<div>` Container.  

When the user finished to place all div, he can press the "Generate" button which send the `<div>` Container outerHTML code into a local database.
Then the user can use another script, in php, and past in parameter the id in the database of which render he want to display, then the php script create a page using the code in the database.

My problem is now I want to take the code of this generated html page, then convert it into a png image.

I looked at some other posts and found something interesting : Phantom.js

But what I tried doesn't seem to work. Here is my code :

```
<html>
    <head>
        <title>Test</title>
        <LINK rel='stylesheet' type='text/css' href='style.css'>
        <script type='text/javascript' src='jquery/jquery.js'></script>
        <script type='text/javascript' src='jquery-ui/jquery-ui.js'></script>
    </head>

    <body>
    <script>
        var page = require('webpage').create();
        page.open('http://10.237.35.10/maxime/affichage.php?afficheur=0', function() {
            page.render('affichageTest.png');
            phantom.exit();
        });
    </script>
    </body>
</html>

```

So we have the database with the div outerHTML code contained at the id '0'.
"affichage.php" take in parameter a variable "afficheur" then it ask the database to get the code from this variable. For example, afficheur=0 will return the div code contained in the database at the id=0.  

When I go to "<http://10.237.35.10/maxime/affichage.php?afficheur=0>" I have a html page with the render I want. But when I try to run the script I'd posted higher, I haven't any "affichageTest.png" rendered in my folder.

What do I have to do? Do I have to import anything else to run Phantom.js? Or maybe I need to add something to my code?