Просмотр исходного кода

Updating documentation for version 4

Jonny Wenmoth 10 лет назад
Родитель
Сommit
4b8fe0596a
42 измененных файлов с 5374 добавлено и 2976 удалено
  1. BIN
      .jekyll-metadata
  2. 9 47
      404.html
  3. 16 2
      _config.yml
  4. 58 29
      _includes/default.html
  5. 2 2
      _includes/post.html
  6. 1 1
      _includes/sidebar.html
  7. 91 48
      _site/3.0/2-installation/index.html
  8. 98 58
      _site/3.0/3-usage/index.html
  9. 125 69
      _site/3.0/4-advanced/index.html
  10. 100 59
      _site/3.0/5-troubleshooting/index.html
  11. 88 43
      _site/3.0/index.html
  12. 334 0
      _site/4.0/2-installation/index.html
  13. 656 0
      _site/4.0/3-usage/index.html
  14. 746 0
      _site/4.0/4-custom-scripts/index.html
  15. 291 0
      _site/4.0/5-caching/index.html
  16. 304 0
      _site/4.0/6-debugging/index.html
  17. 236 0
      _site/4.0/7-troubleshooting/index.html
  18. 386 0
      _site/4.0/index.html
  19. 0 207
      _site/404.html
  20. 228 0
      _site/404/index.html
  21. 67 4
      _site/assets/css/style.css
  22. 11 1162
      _site/feed.xml
  23. 143 49
      _site/index.html
  24. 0 294
      _site/page2/index.html
  25. 0 294
      _site/page3/index.html
  26. 0 294
      _site/page4/index.html
  27. 0 294
      _site/page5/index.html
  28. 2 0
      _version_3/1-introduction.md
  29. 1 0
      _version_3/2-installation.md
  30. 1 0
      _version_3/3-usage.md
  31. 3 2
      _version_3/4-advanced.md
  32. 1 0
      _version_3/5-troubleshooting.md
  33. 179 0
      _version_4/1-introduction.md
  34. 125 0
      _version_4/2-installation.md
  35. 409 0
      _version_4/3-usage.md
  36. 416 0
      _version_4/4-custom-scripts.md
  37. 72 0
      _version_4/5-caching.md
  38. 86 0
      _version_4/6-debugging.md
  39. 11 0
      _version_4/7-troubleshooting.md
  40. 67 4
      assets/css/style.css
  41. 0 3
      feed.xml
  42. 11 11
      index.html

BIN
.jekyll-metadata


+ 9 - 47
404.html

@@ -1,52 +1,14 @@
 ---
 layout: page
 ---
-<!----------------------------------------------------------------
-     _ _           _ _          
-  __| | |__  _   _| | |         Ascii arts included in this page:
- / _` | '_ \| | | | | |         - R2D2, provided by: http://www.chris.com/
-| (_| | |_) | |_| | | |         - Texts, generated from: http://www.network-science.de/ascii/
- \__,_|_.__/ \__, |_|_|         http://github.com/dbtek/dbyll
--------------|___/------------------------------------------------>
+    <div class="page-header">
+        <h1>PAGE NOT FOUND</h1>
+    </div>
 
-  <style>
-    pre {
-          background: none;
-          border: none;
-    }
-  </style>
+    <p>Chances are this page has moved.</p>
 
-  <pre>
-
-                       444444444       000000000            444444444   
-                      4::::::::4     00:::::::::00         4::::::::4  
-                     4:::::::::4   00:::::::::::::00      4:::::::::4  
-                    4::::44::::4  0:::::::000:::::::0    4::::44::::4  
-                   4::::4 4::::4  0::::::0   0::::::0   4::::4 4::::4  
-                  4::::4  4::::4  0:::::0     0:::::0  4::::4  4::::4  
-                 4::::4   4::::4  0:::::0     0:::::0 4::::4   4::::4  
-                4::::444444::::4440:::::0 000 0:::::04::::444444::::444
-                4::::::::::::::::40:::::0 000 0:::::04::::::::::::::::4
-                4444444444:::::4440:::::0     0:::::04444444444:::::444
-                          4::::4  0:::::0     0:::::0          4::::4  
-                          4::::4  0::::::0   0::::::0          4::::4  
-                          4::::4  0:::::::000:::::::0          4::::4  
-                        44::::::44 00:::::::::::::00         44::::::44
-                        4::::::::4   00:::::::::00           4::::::::4
-                        4444444444     000000000             4444444444
-
-         ,-----.             _   _     _           _                 _     _               _   
-       ,'_/_|_\_`.          | |_| |__ (_)___   ___| |__   ___  _   _| | __| |  _ __   ___ | |_ 
-      /<<::8[O]::>\         | __| '_ \| / __| / __| '_ \ / _ \| | | | |/ _` | | '_ \ / _ \| __|
-     _|-----------|_        | |_| | | | \__ \ \__ \ | | | (_) | |_| | | (_| | | | | | (_) | |_ 
- :::|  | ====-=- |  |:::     \__|_| |_|_|___/ |___/_| |_|\___/ \__,_|_|\__,_| |_| |_|\___/ \__|
- :::|  | -=-==== |  |:::                                                                         
- :::\  | ::::|()||  /:::     _                                                          
- ::::| | ....|()|| |::::    | |__   __ _ _ __  _ __   ___ _ __       _____   _____ _ __ 
-     | |_________| |        | '_ \ / _` | '_ \| '_ \ / _ \ '_ \     / _ \ \ / / _ \ '__|
-     | |\_______/| |        | | | | (_| | |_) | |_) |  __/ | | |_  |  __/\ V /  __/ |   
-    /   \ /   \ /   \       |_| |_|\__,_| .__/| .__/ \___|_| |_( )  \___| \_/ \___|_|   
-    `---' `---' `---'                   |_|   |_|              |/                       
-
-
-    </pre>
+    <ul>
+        {% for item in site[site.latest_collection] %}
+        <li><a href="{{ site.BASE_PATH}}{{ item.url }}">{{ item.title }}</a></li>
+        {% endfor %}
+    </ul>

+ 16 - 2
_config.yml

@@ -1,8 +1,11 @@
 
 paginate: 1 
-permalink: none
+permalink: :title/
 paginate_path: "page:num"
-exclude: ["README.md"] 
+gems:
+    - jekyll-paginate
+exclude:
+    - "README.md" 
 highlighter: pygments
 markdown: kramdown
 kramdown:
@@ -15,6 +18,14 @@ defaults:
     values:
       title: PHP PhantomJS
 
+collections:
+  version_3:
+    output: true
+    permalink: /3.0/:title/
+  version_4:
+    output: true
+    permalink: /4.0/:title/
+
 title: PHP PhantomJs
 description: Run PhantomJS scripts through PHP
 
@@ -29,4 +40,7 @@ github:
 
 rss_path: feed.xml
 
+latest_version: 4.0
+latest_collection: version_4
+
 BASE_PATH: http://jonnnnyw.github.io/php-phantomjs

+ 58 - 29
_includes/default.html

@@ -45,71 +45,100 @@
 </head>
 
 <body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
+    
+    {% if page.version %}
+        {% assign version = page.version %}
+        {% assign collection = page.collection %}
+    {% else %}
+        {% assign version = site.latest_version %}
+        {% assign collection = site.latest_collection %}
+    {% endif %} 
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
 		<!-- Brand and toggle get grouped for better mobile display -->
 		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
 				<span class="sr-only">Toggle navigation</span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 			</button>
 			
-			{% if site.github.fork %}
-            <iframe src="http://ghbtns.com/github-btn.html?user={{ site.github.username }}&repo={{ site.github.repo }}&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		{% endif %}
-			
-			{% if site.github.watch %}
-            <iframe src="http://ghbtns.com/github-btn.html?user={{ site.github.username }}&repo={{ site.github.repo }}&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		{% endif %}
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>{{ version }}</b> version</</span>
+			</button>
     		
 			<a class="navbar-brand" href="{{ site.BASE_PATH }}/">
 				<img src="{{ site.BASE_PATH }}/assets/media/phantomjs-small.png" class="img-circle" />
 				{{ site.title }}
 			</a>
 		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="{{ site.BASE_PATH }}/">Home</a></li>
-				<li><a href="{{ site.BASE_PATH}}/installation.html">Installation</a></li>
-				<li><a href="{{ site.BASE_PATH}}/usage.html">Usage</a></li>
-				<li><a href="{{ site.BASE_PATH}}/advanced.html">Advanced</a></li>
-				<li><a href="{{ site.BASE_PATH}}/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="{{ site.BASE_PATH }}/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="{{ site.BASE_PATH }}/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			{% for item in site[collection] %}
+                    <li><a href="{{ site.BASE_PATH}}{{ item.url }}">{{ item.title }}</a></li>
+                    {% endfor %}
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
 	</nav>
-
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>{{ version }}</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="{{ site.BASE_PATH }}/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="{{ site.BASE_PATH }}/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
 	<!-- nav-menu-dropdown -->
 	<div class="btn-group hidden-xs" id="nav-menu">
 		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
 			<i class="fa fa-bars"></i>
 		</button>
 		<ul class="dropdown-menu" role="menu">
-		    <li><a href="{{ site.BASE_PATH }}/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="{{ site.BASE_PATH}}/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="{{ site.BASE_PATH}}/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="{{ site.BASE_PATH}}/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="{{ site.BASE_PATH}}/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+		    {% for item in site[collection] %}
+			<li><a href="{{ site.BASE_PATH}}{{ item.url }}"><i class="fa fa-folder"></i>{{ item.title }}</a></li>
+			{% endfor %}
 			<li class="divider"></li>
 			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
 		</ul>
 	</div>
 
+
 	<div class="col-sm-3 sidebar hidden-xs">
 		{% include sidebar.html %}
 	</div>
 
+    <p id="version-notice">You are currently viewing version <span>{{ version }}</span> documentation.</p>
+
 	<div class="col-sm-9 col-sm-offset-3">
+
 		{{ content }}
 
 		<footer>
 			<hr/>
 			<p>
-				&copy; {{ site.time | date: '%Y' }} {{ site.title }}. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
+				&copy; {{ site.time | date: '%Y' }} {{ site.title }}
 			</p>
 		</footer>
 	</div>

+ 2 - 2
_includes/post.html

@@ -3,9 +3,9 @@
 </div>
 	
 <article>
-
+    
 	<div class="col-sm-10">
-	
+      
 	  <div class="article_body">
 	  {{ content }}
 	  </div>

+ 1 - 1
_includes/sidebar.html

@@ -20,7 +20,7 @@
 		{% if site.github.watch %}
 		<li>
             <iframe src="http://ghbtns.com/github-btn.html?user={{ site.github.username }}&repo={{ site.github.repo }}&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
 		</li>
 		{% endif %}
 		{% if site.github.fork %}

+ 91 - 48
_site/installation.html → _site/3.0/2-installation/index.html

@@ -43,60 +43,96 @@
 </head>
 
 <body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
 		<!-- Brand and toggle get grouped for better mobile display -->
 		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
 				<span class="sr-only">Toggle navigation</span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 			</button>
 			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>3.0</b> version</</span>
+			</button>
     		
 			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
 				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
 				PHP PhantomJs
 			</a>
 		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/">Advanced Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
 	</nav>
-
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>3.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
 	<!-- nav-menu-dropdown -->
 	<div class="btn-group hidden-xs" id="nav-menu">
 		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
 			<i class="fa fa-bars"></i>
 		</button>
 		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/"><i class="fa fa-folder"></i>Advanced Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
 			<li class="divider"></li>
 			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
 		</ul>
 	</div>
 
+
 	<div class="col-sm-3 sidebar hidden-xs">
 		<! -- sidebar.html -->
 <header class="sidebar-header" role="banner">
@@ -120,7 +156,7 @@
 		
 		<li>
             <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
 		</li>
 		
 		
@@ -136,15 +172,18 @@
 
 	</div>
 
+    <p id="version-notice">You are currently viewing version <span>3.0</span> documentation.</p>
+
 	<div class="col-sm-9 col-sm-offset-3">
+
 		<div class="page-header">
   <h1>Installation </h1>
 </div>
 	
 <article>
-
+    
 	<div class="col-sm-10">
-	
+      
 	  <div class="article_body">
 	  <ul>
   <li><a href="#prerequisites">Prerequisites</a></li>
@@ -163,13 +202,13 @@
 
 <p>Install <a href="https://getcomposer.org/">Composer</a> for your project:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    <span class="c">#bash</span>
 
-    <span class="nv">$ </span>curl -s http://getcomposer.org/installer <span class="p">|</span> php</code></pre></div>
+    <span class="nv">$ </span>curl -s http://getcomposer.org/installer <span class="p">|</span> php</code></pre></figure>
 
 <p>Create a <code>composer.json</code> file in the root of your project:</p>
 
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    <span class="c1">#composer.json</span>
 
     <span class="p-Indicator">{</span>
         <span class="s">&quot;require&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
@@ -186,26 +225,28 @@
                 <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
             <span class="p-Indicator">]</span>
         <span class="p-Indicator">}</span>
-    <span class="p-Indicator">}</span></code></pre></div>
+    <span class="p-Indicator">}</span></code></pre></figure>
 
 <p>It is important that you have the ‘scripts’ section shown above in your <code>composer.json</code> file as it will install the latest version of PhantomJS for your system to your project’s bin folder. It is recommended that you create a bin folder in the root of your project as this is where the PHP PhantomJS library will look for your PhantomJS executable. If you would prefer to use a PhantomJS executable in a custom location, see the <a href="#custom-installation">Custom Installation</a> section.</p>
 
 <p>Finally, install the composer depedencies for your project:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
     
-    <span class="nv">$ </span>php composer.phar install</code></pre></div>
+    <span class="nv">$ </span>php composer.phar install</code></pre></figure>
 
 <h2 id="custom-installation">Custom Installation</h2>
 
 <p>If you would prefer to use a custom install location for the PhantomJS executable, you simply need to tell the client where to find the executable file:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
     
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
 
     <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setPhantomJs</span><span class="p">(</span><span class="s1">&#39;/path/to/phantomjs&#39;</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setPhantomJs</span><span class="p">(</span><span class="s1">&#39;/path/to/phantomjs&#39;</span><span class="p">);</span></code></pre></figure>
 
 <blockquote>
   <h4 id="important">Important</h4>
@@ -216,32 +257,34 @@
 
 <p>If you would like composer to install all executable files to a custom bin location when installing dependencies, set the bin dir location in your project’s <code>composer.json</code> file:</p>
 
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    <span class="c1">#composer.json</span>
 
     <span class="p-Indicator">{</span>
         <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
             <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;/path/to/your/projects/bin/dir&quot;</span>
         <span class="p-Indicator">}</span>
-    <span class="p-Indicator">}</span></code></pre></div>
+    <span class="p-Indicator">}</span></code></pre></figure>
 
 <p>You will need to make sure that this directory exists and is writable by Composer before running the composer install.</p>
 
 <p>Once you have updated your bin location run composer install to install PhantomJS:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
     
-    <span class="nv">$ </span>php composer.phar install</code></pre></div>
+    <span class="nv">$ </span>php composer.phar install</code></pre></figure>
 
 <p>This should install the correct PhantomJS executable for your system and the required <code>phantomloader</code> file to the bin locaiton you defined in your <code>composer.json</code> file. </p>
 
 <p>Now you need to tell the client where to find your bin folder:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span> 
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">        </span>
+<span class="x">    </span><span class="cp">&lt;?php</span> 
     
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
 
     <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setBinDir</span><span class="p">(</span><span class="s1">&#39;/path/to/bin/dir&#39;</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setBinDir</span><span class="p">(</span><span class="s1">&#39;/path/to/bin/dir&#39;</span><span class="p">);</span></code></pre></figure>
 
 <h2 id="installing-from-tarball">Installing from tarball</h2>
 
@@ -269,10 +312,10 @@
     <hr>
     <ul class="pager">
         
-        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/introduction.html" title="Introduction">&larr; Introduction</a></li>
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/" title="Usage">&larr; Usage</a></li>
         
         
-        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html" title="Usage">Usage &rarr;</a></li>
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Introduction">Introduction &rarr;</a></li>
         
     </ul>
 
@@ -286,7 +329,7 @@
 		<footer>
 			<hr/>
 			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
+				&copy; 2015 PHP PhantomJs
 			</p>
 		</footer>
 	</div>

+ 98 - 58
_site/usage.html → _site/3.0/3-usage/index.html

@@ -43,60 +43,96 @@
 </head>
 
 <body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
 		<!-- Brand and toggle get grouped for better mobile display -->
 		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
 				<span class="sr-only">Toggle navigation</span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 			</button>
 			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>3.0</b> version</</span>
+			</button>
     		
 			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
 				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
 				PHP PhantomJs
 			</a>
 		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/">Advanced Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
 	</nav>
-
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>3.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
 	<!-- nav-menu-dropdown -->
 	<div class="btn-group hidden-xs" id="nav-menu">
 		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
 			<i class="fa fa-bars"></i>
 		</button>
 		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/"><i class="fa fa-folder"></i>Advanced Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
 			<li class="divider"></li>
 			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
 		</ul>
 	</div>
 
+
 	<div class="col-sm-3 sidebar hidden-xs">
 		<! -- sidebar.html -->
 <header class="sidebar-header" role="banner">
@@ -120,7 +156,7 @@
 		
 		<li>
             <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
 		</li>
 		
 		
@@ -136,15 +172,18 @@
 
 	</div>
 
+    <p id="version-notice">You are currently viewing version <span>3.0</span> documentation.</p>
+
 	<div class="col-sm-9 col-sm-offset-3">
+
 		<div class="page-header">
   <h1>Usage </h1>
 </div>
 	
 <article>
-
+    
 	<div class="col-sm-10">
-	
+      
 	  <div class="article_body">
 	  <p>This page contains some common examples of how to use the PHP PhantomJS library.</p>
 
@@ -168,7 +207,8 @@
 
 <p>A basic GET request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
     
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -184,11 +224,11 @@
     
     <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
         <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
+    <span class="p">}</span></code></pre></figure>
 
 <p>You can also set the URL, request method and timeout period when creating a new request instance through the message factory:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
      
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -201,13 +241,13 @@
     
     <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
         <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
+    <span class="p">}</span></code></pre></figure>
 
 <h2 id="post-request">POST Request</h2>
 
 <p>A basic POST request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
     
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -225,7 +265,7 @@
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setUrl</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">);</span>
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setRequestData</span><span class="p">(</span><span class="nv">$data</span><span class="p">);</span> <span class="c1">// Set post data</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <h2 id="other-request-methods">Other Request Methods</h2>
 
@@ -243,24 +283,24 @@
 
 <p>The request method can be set when creating a new request instance through the message factory:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
     <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
     
-    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;PUT&#39;</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;PUT&#39;</span><span class="p">);</span></code></pre></figure>
 
 <p>Or on the request instance itself:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
     <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
     
     <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span>
-    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMethod</span><span class="p">(</span><span class="s1">&#39;PATCH&#39;</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMethod</span><span class="p">(</span><span class="s1">&#39;PATCH&#39;</span><span class="p">);</span></code></pre></figure>
 
 <h2 id="response-data">Response Data</h2>
 
@@ -329,7 +369,7 @@
 
 <p>You can save screen captures of a page to your local disk by creating a screen capture request and setting the path you wish to save the file to:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -342,13 +382,13 @@
     
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="nv">$file</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>You will need to make sure the directory that you are saving the file to exists and is writable by your application.</p>
 
 <p>You can also set the width, height, x and y axis for your screen capture:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -367,13 +407,13 @@
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="nv">$file</span><span class="p">);</span>
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureDimensions</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">,</span> <span class="nv">$top</span><span class="p">,</span> <span class="nv">$left</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <h2 id="set-viewport-size">Set Viewport Size</h2>
 
 <p>You can easily set the viewport size for a request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -387,13 +427,13 @@
     
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setViewportSize</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <h2 id="custom-timeout">Custom Timeout</h2>
 
 <p>By default, each request will timeout after 5 seconds. You can set a custom timeout period (in milliseconds) for each request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -406,13 +446,13 @@
     
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setTimeout</span><span class="p">(</span><span class="nv">$timeout</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <h2 id="delay-page-render">Delay Page Render</h2>
 
 <p>Sometimes when taking screen captures you may want to wait until the page is completely loaded before saving the capture. In this instance you can set a page render delay (in seconds) for the request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -425,7 +465,7 @@
     
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setDelay</span><span class="p">(</span><span class="nv">$delay</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>You can set a page render delay for standard requests also.</p>
 
@@ -433,7 +473,7 @@
 
 <p>The PhantomJS API contains a range of command line options that can be passed when executing the PhantomJS executable. These can also be passed in via the client before a request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -444,11 +484,11 @@
     <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">);</span>
     <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
 
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>You can also set a path to a JSON configuration file that contains multiple PhantomJS options:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -458,7 +498,7 @@
     <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">);</span>
     <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
 
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>See the <a href="http://phantomjs.org/api/command-line.html">PhantomJS Documentation</a> for a full list of command line options.</p>
 
@@ -471,10 +511,10 @@
     <hr>
     <ul class="pager">
         
-        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html" title="Installation">&larr; Installation</a></li>
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/" title="Advanced Usage">&larr; Advanced Usage</a></li>
         
         
-        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html" title="Advanced Usage">Advanced Usage &rarr;</a></li>
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/" title="Installation">Installation &rarr;</a></li>
         
     </ul>
 
@@ -488,7 +528,7 @@
 		<footer>
 			<hr/>
 			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
+				&copy; 2015 PHP PhantomJs
 			</p>
 		</footer>
 	</div>

+ 125 - 69
_site/advanced.html → _site/3.0/4-advanced/index.html

@@ -43,60 +43,96 @@
 </head>
 
 <body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
 		<!-- Brand and toggle get grouped for better mobile display -->
 		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
 				<span class="sr-only">Toggle navigation</span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 			</button>
 			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>3.0</b> version</</span>
+			</button>
     		
 			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
 				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
 				PHP PhantomJs
 			</a>
 		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/">Advanced Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
 	</nav>
-
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>3.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
 	<!-- nav-menu-dropdown -->
 	<div class="btn-group hidden-xs" id="nav-menu">
 		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
 			<i class="fa fa-bars"></i>
 		</button>
 		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/"><i class="fa fa-folder"></i>Advanced Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
 			<li class="divider"></li>
 			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
 		</ul>
 	</div>
 
+
 	<div class="col-sm-3 sidebar hidden-xs">
 		<! -- sidebar.html -->
 <header class="sidebar-header" role="banner">
@@ -120,7 +156,7 @@
 		
 		<li>
             <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
 		</li>
 		
 		
@@ -136,25 +172,25 @@
 
 	</div>
 
+    <p id="version-notice">You are currently viewing version <span>3.0</span> documentation.</p>
+
 	<div class="col-sm-9 col-sm-offset-3">
+
 		<div class="page-header">
   <h1>Advanced Usage </h1>
 </div>
 	
 <article>
-
+    
 	<div class="col-sm-10">
-	
+      
 	  <div class="article_body">
 	  <ul>
   <li><a href="#phantomjs-command-line-options">PhantomJS command line options</a></li>
-  <li><a href="#custom-phantomjs-scripts">Custom PhantomJS scripts</a>
-    <ul>
-      <li><a href="#writing-a-custom-script">Writing a custom script</a></li>
-      <li><a href="#using-custom-request-parameters-in-your-script">Using custom request parameters in your script</a></li>
-      <li><a href="#loading-your-script">Loading your script</a></li>
-    </ul>
-  </li>
+  <li><a href="#custom-phantomjs-scripts">Custom PhantomJS scripts</a></li>
+  <li><a href="#writing-a-custom-script">Writing a custom script</a></li>
+  <li><a href="#using-custom-request-parameters-in-your-script">Using custom request parameters in your script</a></li>
+  <li><a href="#loading-your-script">Loading your script</a></li>
 </ul>
 
 <hr />
@@ -163,7 +199,7 @@
 
 <p>The PhantomJS API contains a range of command line options that can be passed when executing the PhantomJS executable. These can also be passed in via the client before a request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -174,11 +210,11 @@
     <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">);</span>
     <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
 
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>You can also set a path to a JSON configuration file that contains multiple PhantomJS options:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -188,7 +224,7 @@
     <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">);</span>
     <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
 
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>See the <a href="http://phantomjs.org/api/command-line.html">PhantomJS Documentation</a> for a full list of command line options.</p>
 
@@ -198,12 +234,12 @@
 
 <p>Script files or ‘procedures’ as they are referred to in the application are closely mapped to requests. When you create a default request instance, you are essentially running the default javascript procedure that comes bundled with the application. When you create a capture request you are running the capture procedure.</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
     <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span> <span class="c1">// ~/Resources/procedures/default.proc</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">();</span> <span class="c1">// ~/Resources/procedures/capture.proc</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">();</span> <span class="c1">// ~/Resources/procedures/capture.proc</span></code></pre></figure>
 
 <h3 id="writing-a-custom-script">Writing a custom script</h3>
 
@@ -211,14 +247,19 @@
 
 <p>Create the file somewhere and make sure it can be read by your application. Make a note of the path to the directory where your file is created as you will need this when loading your script which is explained later in this guide.</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
     
     <span class="nv">$ </span>touch my_procedure.proc
-    <span class="nv">$ </span>chmod <span class="m">755</span> my_procedure.proc</code></pre></div>
+    <span class="nv">$ </span>chmod <span class="m">755</span> my_procedure.proc
+    </code></pre></figure>
 
 <p>Next open your procedure file in your text editor and write your PhantomJS script. The <a href="http://phantomjs.org/quick-start.html">PhantomJS documentation</a> has more detailed information on writing custom scripts.</p>
 
-<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="c1">// my_procedure.proc</span>
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    
+    
+    
+    <span class="c1">// my_procedure.proc</span>
 
     <span class="kd">var</span> <span class="nx">page</span>  <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;webpage&#39;</span><span class="p">).</span><span class="nx">create</span><span class="p">();</span>
     
@@ -230,7 +271,10 @@
         <span class="nx">phantom</span><span class="p">.</span><span class="nx">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
     <span class="p">});</span>
     
-    <span class="p">...</span></code></pre></div>
+    <span class="p">...</span>
+    
+    
+    </code></pre></figure>
 
 <blockquote>
   <h4 id="important">Important</h4>
@@ -239,14 +283,20 @@
 
 <p>It is a good practice to create a global error handler in your script that exits PhantomJS:</p>
 
-<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="c1">// my_procedure.proc</span>
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    
+    
+    
+    <span class="c1">// my_procedure.proc</span>
 
     <span class="nx">phantom</span><span class="p">.</span><span class="nx">onError</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">msg</span><span class="p">,</span> <span class="nx">trace</span><span class="p">)</span> <span class="p">{</span>
   
         <span class="nx">phantom</span><span class="p">.</span><span class="nx">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
     <span class="p">};</span>
     
-    <span class="p">...</span></code></pre></div>
+    <span class="p">...</span>
+    
+    
+    </code></pre></figure>
 
 <h3 id="using-custom-request-parameters-in-your-script">Using custom request parameters in your script</h3>
 
@@ -349,7 +399,7 @@
 
 <p>If you would like to inject additional data into your script through custom accessors, simply extend the request class with your own:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Message\Request</span><span class="p">;</span>
     
@@ -360,19 +410,25 @@
         <span class="p">{</span>
             <span class="k">return</span> <span class="s1">&#39;Something!&#39;</span><span class="p">;</span>
         <span class="p">}</span>
-    <span class="p">}</span></code></pre></div>
+    <span class="p">}</span></code></pre></figure>
 
 <p>Now you will be able to access the data in your custom script when using your custom request:</p>
 
-<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="c1">// my_procedure.proc</span>
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    
+    
+    
+    <span class="c1">// my_procedure.proc</span>
 
     <span class="kd">var</span> <span class="nx">something</span> <span class="o">=</span> <span class="s1">&#39;{{ request.getSomething() }}&#39;</span><span class="p">;</span> <span class="c1">// Get something</span>
     
-    <span class="p">...</span></code></pre></div>
+    <span class="p">...</span>
+    
+    
+    </code></pre></figure>
 
 <p>And to use your custom request simply create a new instance of it and pass it to the client:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -384,7 +440,7 @@
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMethod</span><span class="p">(</span><span class="s1">&#39;GET&#39;</span><span class="p">);</span>
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setUrl</span><span class="p">(</span><span class="s1">&#39;http://www.google.com&#39;</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <h3 id="loading-your-script">Loading your script</h3>
 
@@ -392,7 +448,7 @@
 
 <p>The service container has a factory that makes creating a new procedure loader easy:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
     
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\DependencyInjection\ServiceContainer</span><span class="p">;</span>
@@ -404,35 +460,35 @@
     <span class="nv">$procedureLoader</span> <span class="o">=</span> <span class="nv">$serviceContainer</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;procedure_loader_factory&#39;</span><span class="p">)</span>
         <span class="o">-&gt;</span><span class="na">createProcedureLoader</span><span class="p">(</span><span class="nv">$location</span><span class="p">);</span>
         
-    <span class="o">...</span></code></pre></div>
+    <span class="o">...</span></code></pre></figure>
 
 <p>The client contains a chain procedure loader which lets you set multiple loaders at the same time. Ultimately this means that you can load your custom scripts while still maintaining the ability to load the default scripts if you choose. </p>
 
 <p>Now add your procedure loader to the chain loader:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="o">...</span>
     
     <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
     <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureLoader</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addLoader</span><span class="p">(</span><span class="nv">$procedureLoader</span><span class="p">);</span>
     
-    <span class="o">...</span></code></pre></div>
+    <span class="o">...</span></code></pre></figure>
 
 <p>The last thing you need to do is to tell the request which script you want to load for that request. This is done by setting the request type to the name of your procedure file, minus the extension:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="o">...</span>
     
    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span>
    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setType</span><span class="p">(</span><span class="s1">&#39;my_procedure&#39;</span><span class="p">);</span>
     
-    <span class="o">...</span></code></pre></div>
+    <span class="o">...</span></code></pre></figure>
 
 <p>Or if you are using a custom request as outlined in the <a href="#using-custom-request-parameters-in-your-script">custom request parameters</a> section, you can implement a <code>getType()</code> method which returns the name of your procedure, eliminating the need to set the request type for each request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Message\Request</span><span class="p">;</span>
     
@@ -443,11 +499,11 @@
         <span class="p">{</span>
             <span class="k">return</span> <span class="s1">&#39;my_procedure&#39;</span><span class="p">;</span>
         <span class="p">}</span>
-    <span class="p">}</span></code></pre></div>
+    <span class="p">}</span></code></pre></figure>
 
 <p>Below is a full example for clarity:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
     
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\DependencyInjection\ServiceContainer</span><span class="p">;</span>
@@ -467,7 +523,7 @@
     
     <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <blockquote>
   <h4 id="troubleshooting">Troubleshooting</h4>
@@ -485,10 +541,10 @@
     <hr>
     <ul class="pager">
         
-        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html" title="Usage">&larr; Usage</a></li>
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/" title="Troubleshooting">&larr; Troubleshooting</a></li>
         
         
-        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html" title="Troubleshooting">Troubleshooting &rarr;</a></li>
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/" title="Usage">Usage &rarr;</a></li>
         
     </ul>
 
@@ -502,7 +558,7 @@
 		<footer>
 			<hr/>
 			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
+				&copy; 2015 PHP PhantomJs
 			</p>
 		</footer>
 	</div>

+ 100 - 59
_site/troubleshooting.html → _site/3.0/5-troubleshooting/index.html

@@ -43,60 +43,96 @@
 </head>
 
 <body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
 		<!-- Brand and toggle get grouped for better mobile display -->
 		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
 				<span class="sr-only">Toggle navigation</span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 			</button>
 			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>3.0</b> version</</span>
+			</button>
     		
 			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
 				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
 				PHP PhantomJs
 			</a>
 		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/">Advanced Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
 	</nav>
-
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>3.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
 	<!-- nav-menu-dropdown -->
 	<div class="btn-group hidden-xs" id="nav-menu">
 		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
 			<i class="fa fa-bars"></i>
 		</button>
 		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/"><i class="fa fa-folder"></i>Advanced Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
 			<li class="divider"></li>
 			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
 		</ul>
 	</div>
 
+
 	<div class="col-sm-3 sidebar hidden-xs">
 		<! -- sidebar.html -->
 <header class="sidebar-header" role="banner">
@@ -120,7 +156,7 @@
 		
 		<li>
             <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
 		</li>
 		
 		
@@ -136,15 +172,18 @@
 
 	</div>
 
+    <p id="version-notice">You are currently viewing version <span>3.0</span> documentation.</p>
+
 	<div class="col-sm-9 col-sm-offset-3">
+
 		<div class="page-header">
   <h1>Troubleshooting </h1>
 </div>
 	
 <article>
-
+    
 	<div class="col-sm-10">
-	
+      
 	  <div class="article_body">
 	  <ul>
   <li><a href="#its-not-installing-anything-to-my-bin-directory">It’s not installing anything to my bin directory</a></li>
@@ -165,21 +204,22 @@
 
 <p>When installing via composer, as outlined in the <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">installation guide</a>, it is recommended that you define the location of the bin folder for your project. This can be done by adding the following to your <code>composer.json</code> file:</p>
 
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    <span class="c1">#composer.json</span>
 
     <span class="p-Indicator">{</span>
         <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
             <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;/path/to/your/projects/bin/dir&quot;</span>
         <span class="p-Indicator">}</span>
-    <span class="p-Indicator">}</span></code></pre></div>
+    <span class="p-Indicator">}</span></code></pre></figure>
 
 <p>You need to make sure that this directory exists and is writable before you install your composer depedencies.</p>
 
 <p>Once you have defined your bin folder in your <code>composer.json</code> file, run composer install from the root of your project:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
     
-    <span class="nv">$ </span>php composer.phar install</code></pre></div>
+    <span class="nv">$ </span>php composer.phar install</code></pre></figure>
 
 <p>This should install 2 files to your bin folder: <code>phantomjs</code> and <code>phantomloader</code>. If you do not have these 2 files in your bin folder then check that the folder is writable and run composer install again.</p>
 
@@ -196,12 +236,13 @@
 
 <p>If the PHP PhantomJS library cannot locate either of these files then it will throw a <code>InvalidExecutableException</code>. The message in the exception should tell you which one it can’t execute. If both of these files exist and they are executable by your application, you may need to set the path to the directory that these files live in before making a request:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span> 
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">        </span>
+<span class="x">    </span><span class="cp">&lt;?php</span> 
     
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
 
     <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setBinDir</span><span class="p">(</span><span class="s1">&#39;/path/to/bin/dir&#39;</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setBinDir</span><span class="p">(</span><span class="s1">&#39;/path/to/bin/dir&#39;</span><span class="p">);</span></code></pre></figure>
 
 <h4 id="i-am-getting-a-notwritableexception-when-making-a-request">I am getting a <code>NotWritableException</code> when making a request</h4>
 
@@ -227,7 +268,7 @@
 
 <p>To work around this you can try increasing the timeout period in the PHP PhantomJS client:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -240,11 +281,11 @@
     
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setTimeout</span><span class="p">(</span><span class="nv">$timeout</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>If you are still having a problem then you should enable debugging, before you make the request, and check the debug log. This contains a dump of information from PhantomJS which could help to track down why you are not getting a response.</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -256,11 +297,11 @@
         
     <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
     
-    <span class="k">echo</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getLog</span><span class="p">();</span> <span class="c1">// Output log</span></code></pre></div>
+    <span class="k">echo</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getLog</span><span class="p">();</span> <span class="c1">// Output log</span></code></pre></figure>
 
 <p>You can also try running a test script through your PhantomJS executable, from the command line, to see if you get a valid response back. Save the following script somewhere:</p>
 
-<div class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="c1">//test-script.js</span>
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    <span class="c1">//test-script.js</span>
 
     <span class="kd">var</span> <span class="nx">page</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;webpage&#39;</span><span class="p">).</span><span class="nx">create</span><span class="p">(),</span>
         <span class="nx">url</span> <span class="o">=</span> <span class="s1">&#39;YOUR REQUEST URL&#39;</span><span class="p">,</span> <span class="c1">// Change this to the URL you want to request</span>
@@ -282,20 +323,20 @@
         <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">status</span><span class="p">);</span>
         <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">response</span><span class="p">));</span>
         <span class="nx">phantom</span><span class="p">.</span><span class="nx">exit</span><span class="p">();</span>
-    <span class="p">});</span></code></pre></div>
+    <span class="p">});</span></code></pre></figure>
 
 <p>And then, assuming you have saved the script above to <code>test-script.js</code> in the root of your project and your PhantomJS executable is located at <code>bin/phantomjs</code>, run the following:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    <span class="c">#bash</span>
 
-    <span class="nv">$ </span>bin/phantomjs ./test-script.js</code></pre></div>
+    <span class="nv">$ </span>bin/phantomjs ./test-script.js</code></pre></figure>
 
 <p>You should see an output of the response from PhantomJS:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    <span class="c">#bash</span>
 
     success
-    <span class="o">{</span><span class="s2">&quot;contentType&quot;</span>:<span class="s2">&quot;text/javascript; charset=UTF-8&quot;</span>, <span class="s2">&quot;headers&quot;</span>: ...</code></pre></div>
+    <span class="o">{</span><span class="s2">&quot;contentType&quot;</span>:<span class="s2">&quot;text/javascript; charset=UTF-8&quot;</span>, <span class="s2">&quot;headers&quot;</span>: ...</code></pre></figure>
 
 <p>If you don’t see <code>success</code> followed by a JSON encoded response object then there is something the with the URL you are requesting or your PhantomJS executable. Try reinstalling PhantomJS. If you see <code>fail</code> instead of <code>success</code>, chances are the URL you are requesting is invalid or not resolving.</p>
 
@@ -303,7 +344,7 @@
 
 <p>When making a capture request you need to make sure that you are setting the file location that you want the screenshot saved to, including the filename:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -316,7 +357,7 @@
     
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="nv">$file</span><span class="p">);</span> <span class="c1">// Set the capture file</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <p>The file itself does not need to exist but the parent directory must exist and be writable by your application. Check that your application has permissions to write files to the directory you are setting for your screen captures.</p>
 
@@ -324,7 +365,7 @@
 
 <p>Yes, you can set the width and height of your capture along with the x and y coordinates of where the capture should start from:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -343,13 +384,13 @@
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="nv">$file</span><span class="p">);</span>
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureDimensions</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">,</span> <span class="nv">$top</span><span class="p">,</span> <span class="nv">$left</span><span class="p">);</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <h4 id="can-i-set-the-viewport-size">Can I set the viewport size?</h4>
 
 <p>Yes, you can set the viewport dimensions on both regular and capture requests:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -363,13 +404,13 @@
     
     <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setViewportSize</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">);</span> <span class="c1">// Set viewport size</span>
     
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
 
 <h4 id="how-do-i-debug-a-request">How do I debug a request?</h4>
 
 <p>By setting the debug flag to <code>true</code> on the client, you can get a dump of information output from PhantomJS along with some info events added by the PHP PhantomJS library:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -381,11 +422,11 @@
         
     <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
     
-    <span class="k">echo</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getLog</span><span class="p">();</span> <span class="c1">// Output log</span></code></pre></div>
+    <span class="k">echo</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getLog</span><span class="p">();</span> <span class="c1">// Output log</span></code></pre></figure>
 
 <p>You can also get any javacript console errors along with a stack trace from the URL you are calling, in the response object:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
     
@@ -396,7 +437,7 @@
         
     <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
     
-    <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getConsole</span><span class="p">());</span> <span class="c1">// Outputs array of console errors and stack trace</span></code></pre></div>
+    <span class="nb">var_dump</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getConsole</span><span class="p">());</span> <span class="c1">// Outputs array of console errors and stack trace</span></code></pre></figure>
 
 <h4 id="i-am-getting-syntaxerror-parse-error-in-the-debug-log">I am getting <code>SyntaxError: Parse error</code> in the debug log</h4>
 
@@ -411,8 +452,8 @@
     <hr>
     <ul class="pager">
         
-        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html" title="Advanced Usage">&larr; Advanced Usage</a></li>
         
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/" title="Advanced Usage">Advanced Usage &rarr;</a></li>
         
     </ul>
 
@@ -426,7 +467,7 @@
 		<footer>
 			<hr/>
 			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
+				&copy; 2015 PHP PhantomJs
 			</p>
 		</footer>
 	</div>

+ 88 - 43
_site/introduction.html → _site/3.0/index.html

@@ -43,60 +43,96 @@
 </head>
 
 <body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
 		<!-- Brand and toggle get grouped for better mobile display -->
 		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
 				<span class="sr-only">Toggle navigation</span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 			</button>
 			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>3.0</b> version</</span>
+			</button>
     		
 			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
 				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
 				PHP PhantomJs
 			</a>
 		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/">Advanced Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
 	</nav>
-
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>3.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
 	<!-- nav-menu-dropdown -->
 	<div class="btn-group hidden-xs" id="nav-menu">
 		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
 			<i class="fa fa-bars"></i>
 		</button>
 		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/4-advanced/"><i class="fa fa-folder"></i>Advanced Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/5-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
 			<li class="divider"></li>
 			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
 		</ul>
 	</div>
 
+
 	<div class="col-sm-3 sidebar hidden-xs">
 		<! -- sidebar.html -->
 <header class="sidebar-header" role="banner">
@@ -120,7 +156,7 @@
 		
 		<li>
             <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
 		</li>
 		
 		
@@ -136,15 +172,18 @@
 
 	</div>
 
+    <p id="version-notice">You are currently viewing version <span>3.0</span> documentation.</p>
+
 	<div class="col-sm-9 col-sm-offset-3">
+
 		<div class="page-header">
   <h1>Introduction </h1>
 </div>
 	
 <article>
-
+    
 	<div class="col-sm-10">
-	
+      
 	  <div class="article_body">
 	  <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.</p>
 
@@ -173,7 +212,8 @@ code etc.</li>
 
 <p>It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s <code>composer.json</code> file:</p>
 
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    
+    <span class="c1">#composer.json</span>
 
     <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
         <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
@@ -182,21 +222,24 @@ code etc.</li>
         <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
             <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
         <span class="p-Indicator">]</span>
-    <span class="p-Indicator">}</span></code></pre></div>
+    <span class="p-Indicator">}</span>
+    </code></pre></figure>
 
 <p>This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:</p>
 
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    
+    <span class="c1">#composer.json</span>
     
     <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
         <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
-    <span class="p-Indicator">}</span></code></pre></div>
+    <span class="p-Indicator">}</span></code></pre></figure>
 
 <p>Finally, install PHP PhantomJS from the root of your project:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
     
-    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:3.*&quot;</span></code></pre></div>
+    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:3.*&quot;</span></code></pre></figure>
 
 <p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">installation</a> documentation.</p>
 
@@ -204,7 +247,7 @@ code etc.</li>
 
 <p>The following illustrates how to make a basic GET request and output the page content:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
 
@@ -227,11 +270,12 @@ code etc.</li>
 
         <span class="c1">// Dump the requested page content</span>
         <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
+    <span class="p">}</span>
+    </code></pre></figure>
 
 <p>And if you would like to save a screen capture to local disk:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
 
@@ -249,7 +293,8 @@ code etc.</li>
     <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
 
     <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
+    </code></pre></figure>
 
 <p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">usage</a> section, or to create your own custom scripts check out the <a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">advanced</a> documentation.</p>
 
@@ -263,8 +308,8 @@ code etc.</li>
     <hr>
     <ul class="pager">
         
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/2-installation/" title="Installation">&larr; Installation</a></li>
         
-        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html" title="Installation">Installation &rarr;</a></li>
         
     </ul>
 
@@ -278,7 +323,7 @@ code etc.</li>
 		<footer>
 			<hr/>
 			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
+				&copy; 2015 PHP PhantomJs
 			</p>
 		</footer>
 	</div>

+ 334 - 0
_site/4.0/2-installation/index.html

@@ -0,0 +1,334 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Installation</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		<div class="page-header">
+  <h1>Installation </h1>
+</div>
+	
+<article>
+    
+	<div class="col-sm-10">
+      
+	  <div class="article_body">
+	  <ul>
+  <li><a href="#prerequisites">Prerequisites</a></li>
+  <li><a href="#installing-via-composer">Installing via Composer</a></li>
+  <li><a href="#custom-installation">Custom Installation</a></li>
+  <li><a href="#installing-from-tarball">Installing from tarball</a></li>
+</ul>
+
+<hr />
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>PHP PhantomJS requires PHP <strong>5.3.0</strong> or greater to run.</p>
+
+<h2 id="installing-via-composer">Installing via Composer</h2>
+
+<p>Install <a href="https://getcomposer.org/">Composer</a> for your project:</p>
+
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    <span class="c">#bash</span>
+
+    <span class="nv">$ </span>curl -s http://getcomposer.org/installer <span class="p">|</span> php</code></pre></figure>
+
+<p>Create a <code>composer.json</code> file in the root of your project:</p>
+
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    <span class="c1">#composer.json</span>
+
+    <span class="p-Indicator">{</span>
+        <span class="s">&quot;require&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
+            <span class="s">&quot;jonnyw/php-phantomjs&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;4.*&quot;</span>
+        <span class="p-Indicator">},</span>
+        <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
+            <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
+        <span class="p-Indicator">},</span>
+        <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
+            <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
+                <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
+            <span class="p-Indicator">],</span>
+            <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
+                <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
+            <span class="p-Indicator">]</span>
+        <span class="p-Indicator">}</span>
+    <span class="p-Indicator">}</span></code></pre></figure>
+
+<p>It is important that you have the ‘scripts’ section shown above in your <code>composer.json</code> file as it will install the latest version of PhantomJS for your system to your project’s bin folder. It is recommended that you create a bin folder in the root of your project as this is where the PHP PhantomJS library will look for your PhantomJS executable. If you would prefer to use a PhantomJS executable in a custom location, see the <a href="#custom-installation">Custom Installation</a> section.</p>
+
+<p>Finally, install the composer depedencies for your project:</p>
+
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
+    
+    <span class="nv">$ </span>php composer.phar install</code></pre></figure>
+
+<h2 id="custom-installation">Custom Installation</h2>
+
+<p>If you would prefer to use a custom install location for the PhantomJS executable, for example you have PhantomJS installed globally, then you simply need to set the path to PhantomJS manually:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getEngine</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">setPath</span><span class="p">(</span><span class="s1">&#39;/path/to/phantomjs&#39;</span><span class="p">);</span></code></pre></figure>
+
+<p>If you would like composer to install the PhantomJS executable to a custom bin location when installing dependencies, set the bin dir location in your project’s <code>composer.json</code> file:</p>
+
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    <span class="c1">#composer.json</span>
+
+    <span class="p-Indicator">{</span>
+        <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
+            <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;/path/to/your/projects/bin/dir&quot;</span>
+        <span class="p-Indicator">}</span>
+    <span class="p-Indicator">}</span></code></pre></figure>
+
+<p>You will need to make sure that this directory exists and is writable by Composer before running the composer install.</p>
+
+<p>Once you have updated your bin location run composer install to install PhantomJS:</p>
+
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
+    
+    <span class="nv">$ </span>php composer.phar install</code></pre></figure>
+
+<p>This should install the correct PhantomJS executable for your system in the bin locaiton you defined in your <code>composer.json</code> file. </p>
+
+<h2 id="installing-from-tarball">Installing from tarball</h2>
+
+<p>The PHP PhantomJS library contains several depedencies in order to function so it is recommended that you install it via composer as this will handle your dependencies for you. If you do wish to install it from a <a href="https://github.com/jonnnnyw/php-phantomjs/tags">tarball release</a> then you will need to install the dependencies manually.</p>
+
+<p>The PHP PhantomJS library currently requires the following depdencies:</p>
+
+<ul>
+  <li><a href="https://github.com/symfony/Config">Symfony Config Component</a> ~2.5</li>
+  <li><a href="https://github.com/symfony/Yaml">Symfony YAML Component</a> ~2.5</li>
+  <li><a href="https://github.com/symfony/DependencyInjection">Symfony Dependency Injection Component</a> ~2.5</li>
+  <li><a href="https://github.com/symfony/filesystem">Symfony Filesystem Component</a> ~2.5</li>
+  <li><a href="https://github.com/fabpot/Twig">Twig templating Component</a> ~1.16</li>
+  <li><a href="http://phantomjs.org/">PhantomJS</a> ~1.9</li>
+</ul>
+
+<p>Make sure the components are in your include path and that the PhantomJS executable is installed to your projects bin folder as mentioned in the <a href="#custom-installation">Custom Installation</a> section.</p>
+
+	  </div>
+
+    </div>
+
+    <div class="clearfix"></div>
+    
+    <hr>
+    <ul class="pager">
+        
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/" title="Usage">&larr; Usage</a></li>
+        
+        
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Introduction">Introduction &rarr;</a></li>
+        
+    </ul>
+
+	
+    
+</article>
+
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 656 - 0
_site/4.0/3-usage/index.html

@@ -0,0 +1,656 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Usage</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		<div class="page-header">
+  <h1>Usage </h1>
+</div>
+	
+<article>
+    
+	<div class="col-sm-10">
+      
+	  <div class="article_body">
+	  <p>This page contains some common examples of how to use the PHP PhantomJS library.</p>
+
+<ul>
+  <li><a href="#setup">Setup</a></li>
+  <li><a href="#basic-request">Basic Request</a></li>
+  <li><a href="#post-request">POST Request</a></li>
+  <li><a href="#other-request-methods">Other Request Methods</a></li>
+  <li><a href="#response-data">Response Data</a></li>
+  <li><a href="#screen-captures">Screen Captures</a></li>
+  <li><a href="#output-to-pdf">Output To PDF</a></li>
+  <li><a href="#set-viewport-size">Set Viewport Size</a></li>
+  <li><a href="#custom-timeout">Custom Timeout</a></li>
+  <li><a href="#delay-page-render">Delay Page Render</a></li>
+  <li><a href="#phantomjs-options">PhantomJS Options</a></li>
+  <li><a href="#exceptions">Exceptions</a></li>
+</ul>
+
+<p>For more advanced customization or to load your own PhantomJS scripts, see the <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/custom-scripts/">custom scripts</a> section.</p>
+
+<hr />
+
+<h2 id="setup">Setup</h2>
+
+<p>By default the PhantomJS library will look for the PhantomJS executable in the bin folder relative to where your script is running <code>~/bin/phantomjs</code>. If the executable cannot be found or if the path to your PhantomJS executable differs from the default location, for example you have installed PhantomJS globally, you will need to define the path to your PhantomJS executable manually.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getEngine</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">setPath</span><span class="p">(</span><span class="s1">&#39;/path/to/phantomjs&#39;</span><span class="p">);</span>
+    </code></pre></figure>
+
+<blockquote>
+  <h4 id="note">Note</h4>
+  <p>The path must include the name of the PhantomJS executable in it, not just a path to the directory containing the executable.</p>
+</blockquote>
+
+<h2 id="basic-request">Basic Request</h2>
+
+<p>A basic GET request:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMethod</span><span class="p">(</span><span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setUrl</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
+    
+    <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
+        <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
+    <span class="p">}</span></code></pre></figure>
+
+<p>You can also set the URL, request method and timeout period when creating a new request instance through the message factory:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+     
+    <span class="o">...</span>
+    
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">,</span> <span class="mi">5000</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<h2 id="post-request">POST Request</h2>
+
+<p>A basic POST request:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+    
+    <span class="nv">$data</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
+        <span class="s1">&#39;param1&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Param 1&#39;</span><span class="p">,</span>
+        <span class="s1">&#39;param2&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Param 2&#39;</span>
+    <span class="p">);</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMethod</span><span class="p">(</span><span class="s1">&#39;POST&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setUrl</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setRequestData</span><span class="p">(</span><span class="nv">$data</span><span class="p">);</span> <span class="c1">// Set post data</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
+
+<h2 id="other-request-methods">Other Request Methods</h2>
+
+<p>The PHP PhantomJS library supports the following request methods:</p>
+
+<ul>
+  <li>OPTIONS</li>
+  <li>GET</li>
+  <li>HEAD</li>
+  <li>POST</li>
+  <li>PUT</li>
+  <li>DELETE</li>
+  <li>PATCH</li>
+</ul>
+
+<p>The request method can be set when creating a new request instance through the message factory:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;PUT&#39;</span><span class="p">);</span></code></pre></figure>
+
+<p>Or on the request instance itself:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMethod</span><span class="p">(</span><span class="s1">&#39;PATCH&#39;</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<h2 id="response-data">Response Data</h2>
+
+<p>A standard response object gives you access to the following interface:</p>
+
+<table>
+  <thead>
+    <tr>
+      <th style="text-align: center">Accessor</th>
+      <th>Description</th>
+      <th style="text-align: center">Return Type</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td style="text-align: center">getHeaders()</td>
+      <td>Returns an array of all response headers.</td>
+      <td style="text-align: center">Array</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">getHeader(<em>header</em>)</td>
+      <td>Returns the value for a specific response header e.g. Content-Type.</td>
+      <td style="text-align: center">Mixed</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">getStatus()</td>
+      <td>The response status code e.g. 200.</td>
+      <td style="text-align: center">Integer</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">getContent()</td>
+      <td>The raw page content of the requested page.</td>
+      <td style="text-align: center">String</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">getContentType()</td>
+      <td>The content type of the requested page.</td>
+      <td style="text-align: center">String</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">getUrl()</td>
+      <td>The URL of the requested page.</td>
+      <td style="text-align: center">String</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">getRedirectUrl()</td>
+      <td>If the response was a redirect, this will return the redirect URL.</td>
+      <td style="text-align: center">String</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">isRedirect()</td>
+      <td>Will return true if the response was a redirect or false otherwise.</td>
+      <td style="text-align: center">Boolean</td>
+    </tr>
+    <tr>
+      <td style="text-align: center">getConsole()</td>
+      <td>Returns an array of any javascript errors on the requested page along with a stack trace.</td>
+      <td style="text-align: center">Array</td>
+    </tr>
+  </tbody>
+</table>
+
+<blockquote>
+  <h4 id="note-1">Note</h4>
+  <p>If the response ever contains a status code of 0, chances are the request failed. Check the request <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/troubleshooting/#how-do-i-debug-a-request">debug log</a> for more detailed information about what may have gone wrong.</p>
+</blockquote>
+
+<h2 id="screen-captures">Screen Captures</h2>
+
+<p>You can save screen captures of a page to your local disk by creating a screen capture request and setting the path you wish to save the file to:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+    
+    <span class="nv">$file</span> <span class="o">=</span> <span class="s1">&#39;/path/to/save/your/screen/capture/file.jpg&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOutputFile</span><span class="p">(</span><span class="nv">$file</span><span class="p">);</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
+
+<p>You will need to make sure the directory that you are saving the file to exists and is writable by your application.</p>
+
+<p>You can also set the width, height, x and y axis for your screen capture:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="o">...</span>
+    
+    <span class="nv">$top</span>    <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>
+    <span class="nv">$left</span>   <span class="o">=</span> <span class="mi">10</span><span class="p">;</span>
+    <span class="nv">$width</span>  <span class="o">=</span> <span class="mi">200</span><span class="p">;</span>
+    <span class="nv">$height</span> <span class="o">=</span> <span class="mi">400</span><span class="p">;</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureDimensions</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">,</span> <span class="nv">$top</span><span class="p">,</span> <span class="nv">$left</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<h2 id="output-to-pdf">Output To PDF</h2>
+
+<p>You can output a page to PDF by creating a PDF request and setting the path you wish to save the document to.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createPdfRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+    
+    <span class="nv">$file</span> <span class="o">=</span> <span class="s1">&#39;/path/to/save/your/pdf/document.pdf&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOutputFile</span><span class="p">(</span><span class="nv">$file</span><span class="p">);</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
+
+<p>You can set the paper size and margin of the PDF.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$width</span>  <span class="o">=</span> <span class="s1">&#39;10cm&#39;</span><span class="p">;</span>
+    <span class="nv">$height</span> <span class="o">=</span> <span class="s1">&#39;20cm&#39;</span><span class="p">;</span>
+    <span class="nv">$margin</span> <span class="o">=</span> <span class="s1">&#39;2cm&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setPaperSize</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMargin</span><span class="p">(</span><span class="nv">$margin</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<p>If you prefer, you can set a standard paper format such as A4 instead of paper size.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$format</span> <span class="o">=</span> <span class="s1">&#39;A4&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setFormat</span><span class="p">(</span><span class="nv">$format</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<p>Along with the paper orientation.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$orientation</span> <span class="o">=</span> <span class="s1">&#39;landscape&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOrientation</span><span class="p">(</span><span class="nv">$orientation</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<h2 id="set-viewport-size">Set Viewport Size</h2>
+
+<p>You can easily set the viewport size for a request:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$width</span>  <span class="o">=</span> <span class="mi">200</span><span class="p">;</span>
+    <span class="nv">$height</span> <span class="o">=</span> <span class="mi">400</span><span class="p">;</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setViewportSize</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<h2 id="custom-timeout">Custom Timeout</h2>
+
+<p>By default, each request will timeout after 5 seconds. You can set a custom timeout period (in milliseconds) for each request:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="o">...</span>
+    
+    <span class="nv">$timeout</span> <span class="o">=</span> <span class="mi">10000</span><span class="p">;</span> <span class="c1">// 10 seconds</span>
+    
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setTimeout</span><span class="p">(</span><span class="nv">$timeout</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<h2 id="delay-page-render">Delay Page Render</h2>
+
+<p>Sometimes when saving a page to local disk you may want to wait until the page is completely loaded first. In this instance you can set a page render delay (in seconds) for the request:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$delay</span> <span class="o">=</span> <span class="mi">5</span><span class="p">;</span> <span class="c1">// 5 seconds</span>
+    
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setDelay</span><span class="p">(</span><span class="nv">$delay</span><span class="p">);</span>
+    
+    <span class="o">...</span>
+    </code></pre></figure>
+
+<h2 id="phantomjs-options">PhantomJS Options</h2>
+
+<p>The PhantomJS API contains a range of command line options that can be passed when executing the PhantomJS executable. These can also be passed in via the client before a request:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getEngine</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addOption</span><span class="p">(</span><span class="s1">&#39;--load-images=true&#39;</span><span class="p">);</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getEngine</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addOption</span><span class="p">(</span><span class="s1">&#39;--ignore-ssl-errors=true&#39;</span><span class="p">);</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">);</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
+
+<p>You can also set a path to a JSON configuration file that contains multiple PhantomJS options:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getEngine</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addOption</span><span class="p">(</span><span class="s1">&#39;--config=/path/to/config.json&#39;</span><span class="p">);</span>
+    
+    <span class="o">...</span></code></pre></figure>
+
+<p>See the <a href="http://phantomjs.org/api/command-line.html">PhantomJS Documentation</a> for a full list of command line options.</p>
+
+<h2 id="exceptions">Exceptions</h2>
+
+<p>The following offers an explanation of the exceptions that may be raised by the PhantomJS library.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Exception</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>InvalidExecutableException</td>
+      <td>The path to the PhantomJS executable is invalid or is not executable.</td>
+    </tr>
+    <tr>
+      <td>InvalidMethodException</td>
+      <td>The request method is invalid. It must be one of OPTIONS, GET, HEAD, POST, PUT, DELETE or PATCH.</td>
+    </tr>
+    <tr>
+      <td>InvalidUrlException</td>
+      <td>The URL you are requesting is an invalid format.</td>
+    </tr>
+    <tr>
+      <td>NotExistsException</td>
+      <td>A file could not be found or does not exist.</td>
+    </tr>
+    <tr>
+      <td>NotWritableException</td>
+      <td>A file could not be written.</td>
+    </tr>
+    <tr>
+      <td>ProcedureFailedException</td>
+      <td>A PhantomJS script failed to execute successfully.</td>
+    </tr>
+    <tr>
+      <td>RequirementException</td>
+      <td>A PhantomJS script is missing a required element e.g. <code>phantom.exit(1);</code>.</td>
+    </tr>
+    <tr>
+      <td>SyntaxException</td>
+      <td>A PhantomJS script contains a javascript syntax error.</td>
+    </tr>
+  </tbody>
+</table>
+
+	  </div>
+
+    </div>
+
+    <div class="clearfix"></div>
+    
+    <hr>
+    <ul class="pager">
+        
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/" title="Custom Scripts">&larr; Custom Scripts</a></li>
+        
+        
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/" title="Installation">Installation &rarr;</a></li>
+        
+    </ul>
+
+	
+    
+</article>
+
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 746 - 0
_site/4.0/4-custom-scripts/index.html

@@ -0,0 +1,746 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Custom Scripts</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		<div class="page-header">
+  <h1>Custom Scripts </h1>
+</div>
+	
+<article>
+    
+	<div class="col-sm-10">
+      
+	  <div class="article_body">
+	  <ul>
+  <li><a href="#custom-phantomjs-scripts">Custom PhantomJS scripts</a></li>
+  <li><a href="#partial-script-injection">Partial script injection</a></li>
+  <li><a href="#writing-a-custom-template">Writing a custom template</a></li>
+  <li><a href="#using-custom-request-parameters-in-your-script">Using custom request parameters in your script</a></li>
+</ul>
+
+<hr />
+
+<h2 id="custom-phantomjs-scripts">Custom PhantomJS scripts</h2>
+
+<p>In most cases you shouldn’t need to worry about the javascript files that run the PHP PhantomJS library but there may be times when you want to execute your own custom PhantomJS scripts through the client. This can be easily achieved in 2 ways - either through <a href="#partial-script-injection">partial script injection</a> or by <a href="#writing-a-custom-template">writing your own custom template</a>.</p>
+
+<p>When PhantomJS performs a request it loads a script template file and builds a PhantomJS script by injecting small blocks of javascript code into the template. These partial code blocks inject functionality such as setting the viewport size, capture options, error handling etc. These code blocks may be overridden allowing you to manipulate the way requests are performed, with little effort.</p>
+
+<p>Alternatively you can write your own script template changing how PHP PhantomJS executes scripts altogether. This requires more work but can be very powerful.</p>
+
+<blockquote>
+  <h4 id="note">Note</h4>
+  <p>PHP PhantomJS compiles, validates and caches scripts when they are first run to greatly improve performance. If you would like to clear this cache or disable it while you are writing your own scripts then refer to the <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/caching/">caching section</a>.</p>
+</blockquote>
+
+<h2 id="partial-script-injection">Partial script injection</h2>
+
+<p>Partial script injection is the easiest way to manipulate the scripts that are executed by PhantomJS. When PHP PhantomJS performs a request it loads a script template and compiles small blocks of javascript into the template before executing the script. These injected blocks contain different pieces of PhantomJS functionality such as setting the viewport size, capture options, logging and error handling etc. You can override as many of these blocks as you please to change they way a script functions.</p>
+
+<p>The following outlines the partial blocks that are compiled into a PHP PhantomJS template by default.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Block Name</th>
+      <th>Description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td><a href="http://">global_variables.partial</a></td>
+      <td>Allows any javascript variables to be injected at the top of the script.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_clip_rect.partial</a></td>
+      <td>If the request is a screen capture, this will define the page clipping rectangle.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_custom_headers.partial</a></td>
+      <td>Set any custom headers on the page object.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_on_error.partial</a></td>
+      <td>Defines the code that is executed on page error.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_on_resource_received.partial</a></td>
+      <td>Defines the code that is executed on resource receive.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_on_resource_timeout.partial</a></td>
+      <td>Defines the code that is executed on resource timeout.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_open.partial</a></td>
+      <td>Defines the code that is executed on page open.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_paper_size.partial</a></td>
+      <td>If the request is PDF output, this will set up the paper size.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_settings.partial</a></td>
+      <td>Defines any page settings most notably the resource timeout value.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">page_viewport_size.partial</a></td>
+      <td>Set up the viewport size if defined in the request.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">phantom_on_error.partial</a></td>
+      <td>Defines the code that is execute on PhantomJS error.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">procedure_capture.partial</a></td>
+      <td>Defines the code that is executed if the request is a capture request.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">procedure_default.partial</a></td>
+      <td>Defines the code that is executed for a default request.</td>
+    </tr>
+    <tr>
+      <td><a href="http://">procedure_pdf.partial</a></td>
+      <td>Defines the code that is executed if the request is a PDF request.</td>
+    </tr>
+  </tbody>
+</table>
+
+<blockquote>
+  <h4 id="note-1">Note</h4>
+  <p>It may pay to check out the <a href="http://">default script template</a> to see where each of these blocks are rendered when compiling the PhantomJS script.</p>
+</blockquote>
+
+<p>To override a partial block with your own code first you need to create a file with the same name as the block that you are overriding. Make sure that this file can be read by your application.</p>
+
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
+    
+    <span class="nv">$ </span>touch phantom_on_error.partial
+    <span class="nv">$ </span>chmod <span class="m">755</span> phantom_on_error.partial
+    </code></pre></figure>
+
+<p>Next open your partial block in your text editor and write the code you wish to execute. The <a href="http://phantomjs.org/quick-start.html">PhantomJS documentation</a> has more detailed information on writing custom scripts.</p>
+
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    
+    
+    
+    <span class="c1">// phantom_on_error.partial</span>
+    
+    <span class="kd">var</span> <span class="nx">error</span> <span class="o">=</span> <span class="p">{</span>
+      <span class="nx">msg</span><span class="o">:</span> <span class="s1">&#39;There was an error!&#39;</span>  
+    <span class="p">};</span>
+    
+    <span class="nx">system</span><span class="p">.</span><span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">error</span><span class="p">));</span>
+    <span class="nx">phantom</span><span class="p">.</span><span class="nx">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
+
+    <span class="p">...</span>
+    
+    
+    </code></pre></figure>
+
+<p>Now you need to tell PHP PhantomJS where to look for your partial block. This is achieved by creating a procedure loader that points at your custom script directory. The service container has a factory that makes creating a new procedure loader easy.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\DependencyInjection\ServiceContainer</span><span class="p">;</span>
+    
+    <span class="nv">$location</span> <span class="o">=</span> <span class="s1">&#39;/path/to/your/script/directory&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$serviceContainer</span> <span class="o">=</span> <span class="nx">ServiceContainer</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$procedureLoader</span> <span class="o">=</span> <span class="nv">$serviceContainer</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;procedure_loader_factory&#39;</span><span class="p">)</span>
+        <span class="o">-&gt;</span><span class="na">createProcedureLoader</span><span class="p">(</span><span class="nv">$location</span><span class="p">);</span>
+        
+    <span class="o">...</span></code></pre></figure>
+
+<p>Finally add your procedure loader to the load loop. By default the client contains a chain procedure loader which lets you maintain multiple procedure loaders. Ultimately this means that you can load your custom script blocks while still maintaining the ability to load the default ones.</p>
+
+<p>So now just add the procedure loader that you created above to the chain loader.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureLoader</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addLoader</span><span class="p">(</span><span class="nv">$procedureLoader</span><span class="p">);</span>
+    
+    <span class="o">...</span></code></pre></figure>
+
+<blockquote>
+  <h4 id="note-2">Note</h4>
+  <p>If multiple procedure loaders are defined, PHP PhantomJS will alwasy look for custom scripts first before falling back on the default ones.</p>
+</blockquote>
+
+<p>Now whenever you perform a request PHP PhantomJS will look in your script directory first for any partial blocks to inject. You can override as many script blocks as you wish but be aware that in doing so you may limit or break the functionality of the PHP PhantomJS library.</p>
+
+<p>Below is a full example for clarity.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\DependencyInjection\ServiceContainer</span><span class="p">;</span>
+    
+    <span class="nv">$location</span> <span class="o">=</span> <span class="s1">&#39;/path/to/your/script/directory&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$serviceContainer</span> <span class="o">=</span> <span class="nx">ServiceContainer</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$procedureLoader</span> <span class="o">=</span> <span class="nv">$serviceContainer</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;procedure_loader_factory&#39;</span><span class="p">)</span>
+        <span class="o">-&gt;</span><span class="na">createProcedureLoader</span><span class="p">(</span><span class="nv">$location</span><span class="p">);</span>
+        
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureLoader</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addLoader</span><span class="p">(</span><span class="nv">$procedureLoader</span><span class="p">);</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
+
+<blockquote>
+  <h4 id="note-3">Note</h4>
+  <p>PHP PhantomJS compiles and caches scripts when they are first run to greatly improve performance. This cache can be easily <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/caching/#clearing-the-cache">cleared</a> or <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/caching/#disabling-the-cache">disabled</a> while you are developing your own custom scripts. Do be aware that script execution time will be greatly increased by disabling the cache.</p>
+</blockquote>
+
+<blockquote>
+  <h4 id="note-4">Note</h4>
+  <p>Scripts are validated using a Javascript validation engine when they are compiled. For help debugging validation errors see the <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/debugging/#validation-errors">debugging</a> section.</p>
+</blockquote>
+
+<h2 id="writing-a-custom-template">Writing a custom template</h2>
+
+<p>The script template that is run by PHP PhantomJS on each request can be easily replaced with your own version. This requires more work to get right but can be very powerful.</p>
+
+<p>The first step in creating your script is to create a procedure file somewhere. For the purpose of this guide we will refer to it as <code>my_procedure.proc</code> but in reality it can be called anything you like. The only requirement is that the file extension must be <code>.proc</code>.</p>
+
+<p>Create the file somewhere and make sure it can be read by your application.</p>
+
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
+    
+    <span class="nv">$ </span>touch my_procedure.proc
+    <span class="nv">$ </span>chmod <span class="m">755</span> my_procedure.proc
+    </code></pre></figure>
+
+<p>Next open your procedure file in a text editor and write your PhantomJS script. The <a href="http://phantomjs.org/quick-start.html">PhantomJS documentation</a> has more detailed information on writing scripts for PhantomJS.</p>
+
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    
+    
+    
+    <span class="c1">// my_procedure.proc</span>
+
+    <span class="kd">var</span> <span class="nx">page</span>  <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;webpage&#39;</span><span class="p">).</span><span class="nx">create</span><span class="p">();</span>
+    
+    <span class="nx">page</span><span class="p">.</span><span class="nx">open</span> <span class="p">(</span><span class="s1">&#39;{{ input.getUrl() }}&#39;</span><span class="p">,</span> <span class="s1">&#39;{{ input.getMethod() }}&#39;</span><span class="p">,</span> <span class="s1">&#39;{{ input.getBody() }}&#39;</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">status</span><span class="p">)</span> <span class="p">{</span>
+         
+        <span class="c1">// It is important that you exit PhantomJS</span>
+        <span class="c1">// when your script has run or when you</span>
+        <span class="c1">// encounter an error</span>
+        <span class="nx">phantom</span><span class="p">.</span><span class="nx">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">});</span>
+    
+    <span class="p">...</span>
+    
+    
+    </code></pre></figure>
+
+<blockquote>
+  <h4 id="important">Important</h4>
+  <p>Make sure that <code>phantom.exit(1);</code> is always called after your script has run or if you encounter an error. This requires you to take care when handling PhantomJS errors to ensure that you exit the PhantomJS script, whether the script was successfully executed or not. If you do not call <code>phantom.exit(1);</code> then PhantomJS will continue to run until your PHP script times out. You will most likely receive a validation error if you omit this from your script anyway.</p>
+</blockquote>
+
+<p>It is a good practice to create a global error handler in your script that exits PhantomJS.</p>
+
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    
+    
+    
+    <span class="c1">// my_procedure.proc</span>
+
+    <span class="nx">phantom</span><span class="p">.</span><span class="nx">onError</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">msg</span><span class="p">,</span> <span class="nx">trace</span><span class="p">)</span> <span class="p">{</span>
+  
+        <span class="nx">phantom</span><span class="p">.</span><span class="nx">exit</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
+    <span class="p">};</span>
+    
+    <span class="p">...</span>
+    
+    
+    </code></pre></figure>
+
+<p>As with the overriding of partial blocks mentioned earlier in this section, you need to tell PHP PhantomJS where to look for script template. This is achieved by creating a procedure loader that points at your custom script directory. The service container has a factory that makes creating a new procedure loader easy.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\DependencyInjection\ServiceContainer</span><span class="p">;</span>
+    
+    <span class="nv">$location</span> <span class="o">=</span> <span class="s1">&#39;/path/to/your/script/directory&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$serviceContainer</span> <span class="o">=</span> <span class="nx">ServiceContainer</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$procedureLoader</span> <span class="o">=</span> <span class="nv">$serviceContainer</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;procedure_loader_factory&#39;</span><span class="p">)</span>
+        <span class="o">-&gt;</span><span class="na">createProcedureLoader</span><span class="p">(</span><span class="nv">$location</span><span class="p">);</span>
+        
+    <span class="o">...</span></code></pre></figure>
+
+<p>Now add your procedure loader to the load loop. By default the client contains a chain procedure loader which lets you maintain multiple procedure loaders. Ultimately this means that you can load your custom templates while still maintaining the ability to load the default ones.</p>
+
+<p>So now just add the procedure loader that you created above to the chain loader.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureLoader</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addLoader</span><span class="p">(</span><span class="nv">$procedureLoader</span><span class="p">);</span>
+    
+    <span class="o">...</span></code></pre></figure>
+
+<p>Finally you need to tell the client which procedure template to load when making a request. The template name is the name of your procedure template file minus the <code>.proc</code> part.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="o">...</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setProcedure</span><span class="p">(</span><span class="s1">&#39;my_procedure&#39;</span><span class="p">);</span>
+    
+    <span class="o">...</span></code></pre></figure>
+
+<p>Below is a full example for clarity.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\DependencyInjection\ServiceContainer</span><span class="p">;</span>
+    
+    <span class="nv">$location</span> <span class="o">=</span> <span class="s1">&#39;/path/to/your/script/directory&#39;</span><span class="p">;</span>
+    
+    <span class="nv">$serviceContainer</span> <span class="o">=</span> <span class="nx">ServiceContainer</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$procedureLoader</span> <span class="o">=</span> <span class="nv">$serviceContainer</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;procedure_loader_factory&#39;</span><span class="p">)</span>
+        <span class="o">-&gt;</span><span class="na">createProcedureLoader</span><span class="p">(</span><span class="nv">$location</span><span class="p">);</span>
+        
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">setProcedure</span><span class="p">(</span><span class="s1">&#39;my_procedure&#39;</span><span class="p">);</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureLoader</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">addLoader</span><span class="p">(</span><span class="nv">$procedureLoader</span><span class="p">);</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">();</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
+
+<blockquote>
+  <h4 id="note-5">Note</h4>
+  <p>You may choose to support <a href="#partial-script-injection">partial script blocks</a> in your template. It is worth checking out the <a href="http://">default script template</a> to get an idea on how this is achieved.</p>
+</blockquote>
+
+<h2 id="using-custom-request-parameters-in-your-script">Using custom request parameters in your script</h2>
+
+<p>Before a procedure is executed by the application it is parsed through a template parser. The PHP PhantomJS library uses the popular <a href="https://github.com/fabpot/Twig">Twig templating engine</a>. This gives you access to all the <a href="http://twig.sensiolabs.org/doc/templates.html">Twig niceness</a> which you can use in your custom scripts.</p>
+
+<p>You may have noticed in the <a href="#writing-a-custom-template">writing a custom template</a> section that we have used some Twig template tags referencing an input object e.g. <code>{{ input.getUrl() }}</code>. This is in fact the PHP request instance that you created and passed to the client when sending your request, which is injected into the Twig template parser. As a result you gain full access to all the data contained within the request instance, via the data accessor methods.</p>
+
+<p>A default request instance contains the following accessors.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Accessor</th>
+      <th>Description</th>
+      <th>Twig example</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>getMethod()</td>
+      <td>The request method e.g. GET.</td>
+      <td>{{ input.getMethod() }}</td>
+    </tr>
+    <tr>
+      <td>getTimeout()</td>
+      <td>The request timeout period in milliseconds.</td>
+      <td>{{ input.getTimeout() }}</td>
+    </tr>
+    <tr>
+      <td>getDelay()</td>
+      <td>The page render delay in seconds.</td>
+      <td>{{ input.getDelay() }}</td>
+    </tr>
+    <tr>
+      <td>getViewportWidth()</td>
+      <td>The viewport width.</td>
+      <td>{{ input.getViewportWidth() }}</td>
+    </tr>
+    <tr>
+      <td>getViewportHeight()</td>
+      <td>The viewport height.</td>
+      <td>{{ input.getViewportHeight() }}</td>
+    </tr>
+    <tr>
+      <td>getUrl()</td>
+      <td>The request URL.</td>
+      <td>{{ input.getUrl() }}</td>
+    </tr>
+    <tr>
+      <td>getBody()</td>
+      <td>The request body (POST, PUT).</td>
+      <td>{{ input.getBody() }}</td>
+    </tr>
+    <tr>
+      <td>getHeaders(<em>format</em>)</td>
+      <td>The request headers.</td>
+      <td>{{ input.getHeaders(‘json’) }}</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>A capture request contains a few additional ones.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Accessor</th>
+      <th>Description</th>
+      <th>Twig example</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>getRectTop()</td>
+      <td>The x coordinate of the capture region.</td>
+      <td>{{ input.getRectTop() }}</td>
+    </tr>
+    <tr>
+      <td>getRectLeft()</td>
+      <td>The y coordinate of the capture region.</td>
+      <td>{{ input.getRectLeft() }}</td>
+    </tr>
+    <tr>
+      <td>getRectWidth()</td>
+      <td>The width of the capture region.</td>
+      <td>{{ input.getRectWidth() }}</td>
+    </tr>
+    <tr>
+      <td>getRectHeight()</td>
+      <td>The height of the capture region.</td>
+      <td>{{ input.getRectHeight() }}</td>
+    </tr>
+    <tr>
+      <td>getCaptureFile()</td>
+      <td>The file to save the capture to.</td>
+      <td>{{ input.getCaptureFile() }}</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>And a PDF request a few more.</p>
+
+<table>
+  <thead>
+    <tr>
+      <th>Accessor</th>
+      <th>Description</th>
+      <th>Twig example</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>getPaperWidth()</td>
+      <td>The width to save the PDF e.g. ‘20cm’.</td>
+      <td>{{ input.getPaperWidth() }}</td>
+    </tr>
+    <tr>
+      <td>getPaperHeight()</td>
+      <td>The height to save the PDF e.g. ‘20cm’.</td>
+      <td>{{ input.getPaperHeight() }}</td>
+    </tr>
+    <tr>
+      <td>getFormat()</td>
+      <td>The paper format e.g. ‘A4’.</td>
+      <td>{{ input.getFormat() }}</td>
+    </tr>
+    <tr>
+      <td>getOrientation()</td>
+      <td>The orientation - portrait or landscape.</td>
+      <td>{{ input.getOrientation() }}</td>
+    </tr>
+    <tr>
+      <td>getMargin()</td>
+      <td>The paper margin e.g. ‘1cm’.</td>
+      <td>{{ input.getMargin() }}</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>If you would like to inject additional data into your script through custom accessors, simply extend the request class with your own.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Message\Request</span><span class="p">;</span>
+    
+    <span class="k">class</span> <span class="nc">CustomRequest</span> <span class="k">extends</span> <span class="nx">Request</span>
+    <span class="p">{</span>
+    
+        <span class="k">public</span> <span class="k">function</span> <span class="nf">getSomething</span><span class="p">()</span>
+        <span class="p">{</span>
+            <span class="k">return</span> <span class="s1">&#39;Something!&#39;</span><span class="p">;</span>
+        <span class="p">}</span>
+    <span class="p">}</span></code></pre></figure>
+
+<p>Now you will be able to access the data in your custom script when using your custom request.</p>
+
+<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript">    
+    
+    
+    <span class="c1">// my_procedure.proc</span>
+
+    <span class="kd">var</span> <span class="nx">something</span> <span class="o">=</span> <span class="s1">&#39;{{ input.getSomething() }}&#39;</span><span class="p">;</span> <span class="c1">// Get something</span>
+    
+    <span class="p">...</span>
+    
+    
+    </code></pre></figure>
+
+<p>And to use your custom request simply create a new instance of it and pass it to the client.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+    
+    <span class="nv">$request</span>  <span class="o">=</span> <span class="k">new</span> <span class="nx">CustomRequest</span><span class="p">();</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMethod</span><span class="p">(</span><span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setUrl</span><span class="p">(</span><span class="s1">&#39;http://www.google.com&#39;</span><span class="p">);</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></figure>
+
+<blockquote>
+  <h4 id="troubleshooting">Troubleshooting</h4>
+  <p>If you find that your script isn’t running or that you are receiving a status of ‘0’ back in the response, chances are you have a syntax error in you script. It pays to turn debugging on in the client <code>$client-&gt;debug(true)</code> which will then give you access to some log information through <code>$client-&gt;getLog()</code>.</p>
+</blockquote>
+
+<p>See more detailed information about <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/troubleshooting/">troubleshooting</a>.</p>
+
+	  </div>
+
+    </div>
+
+    <div class="clearfix"></div>
+    
+    <hr>
+    <ul class="pager">
+        
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/" title="Caching">&larr; Caching</a></li>
+        
+        
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/" title="Usage">Usage &rarr;</a></li>
+        
+    </ul>
+
+	
+    
+</article>
+
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 291 - 0
_site/4.0/5-caching/index.html

@@ -0,0 +1,291 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Caching</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		<div class="page-header">
+  <h1>Caching </h1>
+</div>
+	
+<article>
+    
+	<div class="col-sm-10">
+      
+	  <div class="article_body">
+	  <ul>
+  <li><a href="#script-caching">Script caching</a></li>
+  <li><a href="#clearing-the-cache">Clearing the cache</a></li>
+  <li><a href="#disabling-the-cache">Disabling the cache</a></li>
+</ul>
+
+<hr />
+
+<h2 id="script-caching">Script caching</h2>
+
+<p>By default the PHP PhantomJs library compiles and aggressively caches script templates the first time that they are run. This means that if you override any <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/custom-scripts/">partial scripts</a> after the script template has been cached by the library then the changes will not take affect until you <a href="#clearing-the-cache">clear the compiled cache</a>.</p>
+
+<p>It is recommended that you <a href="#disabling-the-cache">disable the compiler cache</a> while developing your own custom scripts.</p>
+
+<blockquote>
+  <h4 id="note">Note</h4>
+  <p>The default cache location is the system tmp directory. The location of this directory can be found through the <code>sys_get_temp_dir()</code> PHP directive.</p>
+</blockquote>
+
+<h2 id="disabling-the-cache">Disabling the cache</h2>
+
+<p>The compiler cache can be easily disabled. When disabled script templates will be compiled for each request and no caching will take place.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureCompiler</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">disableCache</span><span class="p">();</span></code></pre></figure>
+
+<p>The compiler cache is enabled by default however you can enable it manually if the situation arises.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureCompiler</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">enableCache</span><span class="p">();</span></code></pre></figure>
+
+<blockquote>
+  <h4 id="important">Important</h4>
+  <p>Script caching greatly improves performance therefore you should ensure that the cache is enabled in any production environment or in situtations where performance is important.</p>
+</blockquote>
+
+<h2 id="clearing-the-cache">Clearing the cache</h2>
+
+<p>The compiler cache can be easily cleared. This will force script templates to be recompiled and cached on the next request.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span>
+<span class="x">    </span><span class="cp">&lt;?php</span>
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+    
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getProcedureCompiler</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">clearCache</span><span class="p">();</span></code></pre></figure>
+
+	  </div>
+
+    </div>
+
+    <div class="clearfix"></div>
+    
+    <hr>
+    <ul class="pager">
+        
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/" title="Debugging">&larr; Debugging</a></li>
+        
+        
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/" title="Custom Scripts">Custom Scripts &rarr;</a></li>
+        
+    </ul>
+
+	
+    
+</article>
+
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 304 - 0
_site/4.0/6-debugging/index.html

@@ -0,0 +1,304 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Debugging</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		<div class="page-header">
+  <h1>Debugging </h1>
+</div>
+	
+<article>
+    
+	<div class="col-sm-10">
+      
+	  <div class="article_body">
+	  <ul>
+  <li><a href="#phantomjs-log">PhantomJS log</a></li>
+  <li><a href="#javascript-console-log">Javascript console log</a></li>
+  <li><a href="#validation-errors">Validation errors</a></li>
+</ul>
+
+<hr />
+
+<h2 id="phantomjs-log">PhantomJS log</h2>
+
+<p>Verbose logging can be enabled for PhantomJS by setting the debug flag on the client. This is the same as setting the PhantomJS <code>--debug=true</code> command line option.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">        </span>
+<span class="x">    </span><span class="cp">&lt;?php</span> 
+    
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">debug</span><span class="p">(</span><span class="k">true</span><span class="p">);</span></code></pre></figure>
+
+<p>The client log can be inspected after making a request.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">        </span>
+<span class="x">    </span><span class="cp">&lt;?php</span> 
+    
+    <span class="o">...</span>
+    
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getLog</span><span class="p">();</span> <span class="c1">// String</span>
+    
+    <span class="o">...</span></code></pre></figure>
+
+<blockquote>
+  <h4 id="note">Note</h4>
+  <p>The client log contains some helpful information specific to the PhantomJS library. In some cases these are present in the log even if debugging is disabled.</p>
+</blockquote>
+
+<h2 id="javascript-console-log">Javascript console log</h2>
+
+<p>The response object also provides access to a console log. Any javascript errors raised on the requested page will be present in the response console log.</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">        </span>
+<span class="x">    </span><span class="cp">&lt;?php</span> 
+    
+    <span class="o">...</span>
+    
+    <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getConsole</span><span class="p">();</span> <span class="c1">// Array</span>
+    
+    <span class="o">...</span></code></pre></figure>
+
+<h2 id="validation-errors">Validation errors</h2>
+
+<p>Before a script template is compiled and cached it is validated using the <a href="http://">Esprima</a> javascript validation engine. If the script fails to validate then a <code>JonnyW\PhantomJs\Exception\SyntaxException</code> will be raised. Debug information about any validation errors can be found by calling a <code>getErrors()</code> helper method on the exception instance. This will return an array of error information. </p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span> 
+    
+    <span class="c1">// $exception-&gt;getErrors();    </span>
+    <span class="k">array</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
+      <span class="k">array</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="p">{</span>
+        <span class="s1">&#39;lineNumber&#39;</span>  <span class="o">=&gt;</span> <span class="mi">1</span><span class="p">,</span>
+        <span class="s1">&#39;column&#39;</span>      <span class="o">=&gt;</span> <span class="mi">17</span><span class="p">,</span>
+        <span class="s1">&#39;index&#39;</span>       <span class="o">=&gt;</span> <span class="mi">16</span><span class="p">,</span>
+        <span class="s1">&#39;description&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Unexpected token ;&#39;</span><span class="p">,</span>
+        <span class="s1">&#39;message&#39;</span>     <span class="o">=&gt;</span> <span class="s1">&#39;Line 1: Unexpected token ;&#39;</span>
+      <span class="p">}</span>
+    <span class="p">}</span></code></pre></figure>
+
+<blockquote>
+  <h4 id="important">Important</h4>
+  <p>Due to a limitation in the validation logic, scripts are currently minified to a single line before validating. This makes the <code>lineNumber</code> value contained in the error output redundant. This is due to be fixed in a future release.</p>
+</blockquote>
+
+	  </div>
+
+    </div>
+
+    <div class="clearfix"></div>
+    
+    <hr>
+    <ul class="pager">
+        
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/" title="Troubleshooting">&larr; Troubleshooting</a></li>
+        
+        
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/" title="Caching">Caching &rarr;</a></li>
+        
+    </ul>
+
+	
+    
+</article>
+
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 236 - 0
_site/4.0/7-troubleshooting/index.html

@@ -0,0 +1,236 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Troubleshooting</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		<div class="page-header">
+  <h1>Troubleshooting </h1>
+</div>
+	
+<article>
+    
+	<div class="col-sm-10">
+      
+	  <div class="article_body">
+	  <blockquote>
+  <h4 id="todo">@todo</h4>
+  <p>Troubleshooting guide coming soon.</p>
+</blockquote>
+
+	  </div>
+
+    </div>
+
+    <div class="clearfix"></div>
+    
+    <hr>
+    <ul class="pager">
+        
+        
+        <li class="next"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/" title="Debugging">Debugging &rarr;</a></li>
+        
+    </ul>
+
+	
+    
+</article>
+
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 386 - 0
_site/4.0/index.html

@@ -0,0 +1,386 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>Introduction</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		<div class="page-header">
+  <h1>Introduction </h1>
+</div>
+	
+<article>
+    
+	<div class="col-sm-10">
+      
+	  <div class="article_body">
+	  <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures and PDF output.</p>
+
+<h2 id="feature-list">Feature List</h2>
+
+<ul>
+  <li>Load webpages through the PhantomJS headless browser</li>
+  <li>View detailed response data including page content, headers, status<br />
+code etc.</li>
+  <li>Handle redirects</li>
+  <li>View javascript console errors</li>
+  <li>View detailed PhantomJS debuged information</li>
+  <li>Save screen captures to local disk</li>
+  <li>Output web pages to PDF document</li>
+  <li>Set viewport size</li>
+  <li>Define screen capture x, y, width and height parameters</li>
+  <li>Delay page rendering for a specified time</li>
+  <li>Execute PhantomJS with command line options</li>
+  <li>Easily build and run custom PhantomJS scripts</li>
+</ul>
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>PHP PhantomJS requires PHP <strong>5.3.0</strong> or greater to run.</p>
+
+<h2 id="installation">Installation</h2>
+
+<p>It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s <code>composer.json</code> file:</p>
+
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    
+    <span class="c1">#composer.json</span>
+
+    <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
+        <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
+            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
+        <span class="p-Indicator">],</span>
+        <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
+            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
+        <span class="p-Indicator">]</span>
+    <span class="p-Indicator">}</span>
+    </code></pre></figure>
+
+<p>This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:</p>
+
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    
+    <span class="c1">#composer.json</span>
+    
+    <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
+        <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
+    <span class="p-Indicator">}</span></code></pre></figure>
+
+<p>Finally, install PHP PhantomJS from the root of your project:</p>
+
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
+    
+    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:4.*&quot;</span></code></pre></figure>
+
+<p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/installation/">installation</a> documentation.</p>
+
+<blockquote>
+  <h4 id="important">Important</h4>
+  <p>By default the PhantomJS library will look for the PhantomJS executable in the bin folder relative to where your script is running <code>~/bin/phantomjs</code>. If the executable cannot be found or if the path to your PhantomJS executable differs from the default location, for example you have installed PhantomJS globally, you will need to define the path to your PhantomJS executable manually.</p>
+
+  <p><code>$client-&gt;getEngine()-&gt;setPath('/path/to/phantomjs');</code></p>
+</blockquote>
+
+<h2 id="basic-usage">Basic Usage</h2>
+
+<p>The following illustrates how to make a basic GET request and output the page content:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\Request </span>
+<span class="sd">     **/</span>
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
+<span class="sd">     **/</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+
+    <span class="c1">// Send the request</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
+
+    <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
+
+        <span class="c1">// Dump the requested page content</span>
+        <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
+    <span class="p">}</span>
+    </code></pre></figure>
+
+<p>Saving a screen capture to local disk:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+    
+    <span class="nv">$width</span>  <span class="o">=</span> <span class="mi">800</span><span class="p">;</span>
+    <span class="nv">$height</span> <span class="o">=</span> <span class="mi">600</span><span class="p">;</span>
+    <span class="nv">$top</span>    <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="nv">$left</span>   <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\CaptureRequest</span>
+<span class="sd">     **/</span>
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOutputFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/capture/file.jpg&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setViewportSize</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureDimensions</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">,</span> <span class="nv">$top</span><span class="p">,</span> <span class="nv">$left</span><span class="p">);</span>
+
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
+<span class="sd">     **/</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+
+    <span class="c1">// Send the request</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
+    </code></pre></figure>
+
+<p>Outputting a page as PDF:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\PdfRequest</span>
+<span class="sd">     **/</span>
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createPdfRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOutputFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/pdf/document.pdf&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setFormat</span><span class="p">(</span><span class="s1">&#39;A4&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOrientation</span><span class="p">(</span><span class="s1">&#39;landscape&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMargin</span><span class="p">(</span><span class="s1">&#39;1cm&#39;</span><span class="p">);</span>
+
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
+<span class="sd">     **/</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+
+    <span class="c1">// Send the request</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
+    </code></pre></figure>
+
+<p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/usage/">usage</a> section, or you can <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/custom-scripts/">create your own custom scripts</a>.</p>
+
+
+	  </div>
+
+    </div>
+
+    <div class="clearfix"></div>
+    
+    <hr>
+    <ul class="pager">
+        
+        <li class="previous"><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/" title="Installation">&larr; Installation</a></li>
+        
+        
+    </ul>
+
+	
+    
+</article>
+
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 0 - 207
_site/404.html

@@ -1,207 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-	<meta charset="utf-8">
-	<title>PHP PhantomJS</title>
-	
-	<meta name="author" content="Jonny W">
-
-	<!-- Enable responsive viewport -->
-	<meta name="viewport" content="width=device-width, initial-scale=1.0">
-
-	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
-	<!--[if lt IE 9]>
-	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
-	<![endif]-->
-
-	<!-- Le styles -->
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
-
-	<!-- Le fav and touch icons -->
-	<!-- Update these with your own images
-	<link rel="shortcut icon" href="images/favicon.ico">
-	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
-	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
-	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-	-->
-
-	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
-
-   <script>
-        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-        
-        ga('create', 'UA-53289013-1', 'auto');
-        ga('send', 'pageview');
-    </script>
-
-</head>
-
-<body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
-		<!-- Brand and toggle get grouped for better mobile display -->
-		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
-				<span class="sr-only">Toggle navigation</span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-			</button>
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
-    		
-			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
-				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
-				PHP PhantomJs
-			</a>
-		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
-	</nav>
-
-	<!-- nav-menu-dropdown -->
-	<div class="btn-group hidden-xs" id="nav-menu">
-		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
-			<i class="fa fa-bars"></i>
-		</button>
-		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
-			<li class="divider"></li>
-			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
-		</ul>
-	</div>
-
-	<div class="col-sm-3 sidebar hidden-xs">
-		<! -- sidebar.html -->
-<header class="sidebar-header" role="banner">
-	<a href="http://jonnnnyw.github.io/php-phantomjs/">
-		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
-	</a>
-	<h3 class="title">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
-    </h3>
-</header>
-
-
-<div id="bio" class="text-center">
-	Run PhantomJS scripts through PHP
-</div>
-
-
-<div id="contact-list" class="text-center">
-
-	<ul class="list-unstyled list-inline">
-		
-		<li>
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-		
-		<li>
-			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-	</ul>
-
-</div>
-<! -- sidebar.html end -->
-
-	</div>
-
-	<div class="col-sm-9 col-sm-offset-3">
-		
-<!----------------------------------------------------------------
-     _ _           _ _          
-  __| | |__  _   _| | |         Ascii arts included in this page:
- / _` | '_ \| | | | | |         - R2D2, provided by: http://www.chris.com/
-| (_| | |_) | |_| | | |         - Texts, generated from: http://www.network-science.de/ascii/
- \__,_|_.__/ \__, |_|_|         http://github.com/dbtek/dbyll
--------------|___/------------------------------------------------>
-
-  <style>
-    pre {
-          background: none;
-          border: none;
-    }
-  </style>
-
-  <pre>
-
-                       444444444       000000000            444444444   
-                      4::::::::4     00:::::::::00         4::::::::4  
-                     4:::::::::4   00:::::::::::::00      4:::::::::4  
-                    4::::44::::4  0:::::::000:::::::0    4::::44::::4  
-                   4::::4 4::::4  0::::::0   0::::::0   4::::4 4::::4  
-                  4::::4  4::::4  0:::::0     0:::::0  4::::4  4::::4  
-                 4::::4   4::::4  0:::::0     0:::::0 4::::4   4::::4  
-                4::::444444::::4440:::::0 000 0:::::04::::444444::::444
-                4::::::::::::::::40:::::0 000 0:::::04::::::::::::::::4
-                4444444444:::::4440:::::0     0:::::04444444444:::::444
-                          4::::4  0:::::0     0:::::0          4::::4  
-                          4::::4  0::::::0   0::::::0          4::::4  
-                          4::::4  0:::::::000:::::::0          4::::4  
-                        44::::::44 00:::::::::::::00         44::::::44
-                        4::::::::4   00:::::::::00           4::::::::4
-                        4444444444     000000000             4444444444
-
-         ,-----.             _   _     _           _                 _     _               _   
-       ,'_/_|_\_`.          | |_| |__ (_)___   ___| |__   ___  _   _| | __| |  _ __   ___ | |_ 
-      /<<::8[O]::>\         | __| '_ \| / __| / __| '_ \ / _ \| | | | |/ _` | | '_ \ / _ \| __|
-     _|-----------|_        | |_| | | | \__ \ \__ \ | | | (_) | |_| | | (_| | | | | | (_) | |_ 
- :::|  | ====-=- |  |:::     \__|_| |_|_|___/ |___/_| |_|\___/ \__,_|_|\__,_| |_| |_|\___/ \__|
- :::|  | -=-==== |  |:::                                                                         
- :::\  | ::::|()||  /:::     _                                                          
- ::::| | ....|()|| |::::    | |__   __ _ _ __  _ __   ___ _ __       _____   _____ _ __ 
-     | |_________| |        | '_ \ / _` | '_ \| '_ \ / _ \ '_ \     / _ \ \ / / _ \ '__|
-     | |\_______/| |        | | | | (_| | |_) | |_) |  __/ | | |_  |  __/\ V /  __/ |   
-    /   \ /   \ /   \       |_| |_|\__,_| .__/| .__/ \___|_| |_( )  \___| \_/ \___|_|   
-    `---' `---' `---'                   |_|   |_|              |/                       
-
-
-    </pre>
-
-
-
-		<footer>
-			<hr/>
-			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
-			</p>
-		</footer>
-	</div>
-
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
-	
-</body>
-</html>
-

+ 228 - 0
_site/404/index.html

@@ -0,0 +1,228 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8">
+	<title>PHP PhantomJS</title>
+	
+	<meta name="author" content="Jonny W">
+
+	<!-- Enable responsive viewport -->
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+	<!--[if lt IE 9]>
+	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+	<![endif]-->
+
+	<!-- Le styles -->
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
+	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
+
+	<!-- Le fav and touch icons -->
+	<!-- Update these with your own images
+	<link rel="shortcut icon" href="images/favicon.ico">
+	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+	-->
+
+	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
+
+   <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+        
+        ga('create', 'UA-53289013-1', 'auto');
+        ga('send', 'pageview');
+    </script>
+
+</head>
+
+<body>
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
+		<!-- Brand and toggle get grouped for better mobile display -->
+		<div class="navbar-header">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+				<span class="icon-bar"></span>
+			</button>
+			
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
+    		
+			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
+				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
+				PHP PhantomJs
+			</a>
+		</div>
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+	</nav>
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
+	<!-- nav-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-menu">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-bars"></i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
+			<li class="divider"></li>
+			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
+		</ul>
+	</div>
+
+
+	<div class="col-sm-3 sidebar hidden-xs">
+		<! -- sidebar.html -->
+<header class="sidebar-header" role="banner">
+	<a href="http://jonnnnyw.github.io/php-phantomjs/">
+		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
+	</a>
+	<h3 class="title">
+        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
+    </h3>
+</header>
+
+
+<div id="bio" class="text-center">
+	Run PhantomJS scripts through PHP
+</div>
+
+
+<div id="contact-list" class="text-center">
+
+	<ul class="list-unstyled list-inline">
+		
+		<li>
+            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
+		</li>
+		
+		
+		<li>
+			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
+                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+		</li>
+		
+	</ul>
+
+</div>
+<! -- sidebar.html end -->
+
+	</div>
+
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
+	<div class="col-sm-9 col-sm-offset-3">
+
+		
+    <div class="page-header">
+        <h1>PAGE NOT FOUND</h1>
+    </div>
+
+    <p>Chances are this page has moved.</p>
+
+    <ul>
+        
+        <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+        
+        <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+        
+        <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+        
+        <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+        
+        <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+        
+        <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+        
+        <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+        
+    </ul>
+
+
+
+		<footer>
+			<hr/>
+			<p>
+				&copy; 2015 PHP PhantomJs
+			</p>
+		</footer>
+	</div>
+
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
+	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
+	
+</body>
+</html>
+

+ 67 - 4
_site/assets/css/style.css

@@ -83,9 +83,9 @@ article .share .gplus:hover {
 }
 
 .page-header {
+    margin-top: 50px;
     padding: 0 5% 0;
-	color: #e74c3c;
-	text-shadow: 1px 1px 1px rgba(150, 150, 150, 1);
+	color: #2c3e50;
 }
 
 article{
@@ -127,6 +127,24 @@ article.home h4 a:hover {
 	color: #e74c3c;
 }
 
+h2 {
+    margin-top: 40px;
+}
+
+blockquote {
+    margin-top: 30px;
+    background-color: #dbfcff;
+    border-left: 5px solid #30cad4;
+}
+
+code, .highlight .na, .highlight .nv {
+    color: #0fb4c0;
+}
+
+.highlight .sd {
+    color: #999988;
+}
+
 .author .author-image {
   float: left;
   margin-right: 20px;
@@ -134,7 +152,13 @@ article.home h4 a:hover {
 
 footer {
 	padding-top: 15px;
-	font-family: 'Ubuntu';
+    text-align: center;
+}
+
+.panel {
+    margin: 0;
+    border: none;
+    background-color: transparent;
 }
 
 /* nav-vertical-tabs component */
@@ -160,6 +184,10 @@ footer {
     border-radius: 4px 0 0 4px;
 }
 
+.navbar-nav {
+    margin-top: 30px;
+}
+
 .badge { background: #F2756A; }
 
 #nav-menu{
@@ -168,11 +196,34 @@ footer {
     right: 45px;
     z-index: 2000;
 }
+#nav-version{
+    position: fixed;
+    top: 45px;
+    right: 90px;
+    z-index: 2000;
+}
 #nav-menu .dropdown-menu {
     left: inherit;
     right: 0px;
 }
-
+#version-notice{
+    background-color: #30cad4;
+    padding: 5px 10px;
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100%;
+    text-align: center;
+    color: #157380;
+    z-index: 9999;
+}
+#version-notice span {
+    color: #fff;
+}
+.version-toggle {
+    padding-top: 6px;
+    padding-bottom: 6px;
+}
 ul.dropdown-menu>li>a>i.fa {
     width: 1.3em;
 }
@@ -195,3 +246,15 @@ table th, table td {
 table th, table tr:nth-child(even) {
     background-color: #fefefe;
 }
+
+.fa-terminal:before {
+    padding-right: 5px;
+}
+
+@media (max-width: 768px) {
+    #version-notice {
+        top: 67px;
+        position: absolute;
+    }
+}
+

+ 11 - 1162
_site/feed.xml

@@ -1,1169 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 	<channel>
-		<title>PHP PhantomJs</title>
-		<description>Run PhantomJS scripts through PHP</description>
-		<link>http://jonnnnyw.github.io/php-phantomjs/</link>
-		<atom:link href="http://jonnnnyw.github.io/php-phantomjs/feed.xml" rel="self" type="application/rss+xml" />
-		
+		<title>{{ site.title }}</title>
+		<description>{{ site.description }}</description>
+		<link>{{ site.BASE_PATH }}/</link>
+		<atom:link href="{{ site.BASE_PATH }}/{{ site.rss_path }}" rel="self" type="application/rss+xml" />
+		{% for post in site.posts limit:10 %}
 			<item>
-				<title>Introduction</title>
-				<description>&lt;p&gt;PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.&lt;/p&gt;
-
-&lt;h2 id=&quot;feature-list&quot;&gt;Feature List&lt;/h2&gt;
-
-&lt;ul&gt;
-  &lt;li&gt;Load webpages through the PhantomJS headless browser&lt;/li&gt;
-  &lt;li&gt;View detailed response data including page content, headers, status&lt;br /&gt;
-code etc.&lt;/li&gt;
-  &lt;li&gt;Handle redirects&lt;/li&gt;
-  &lt;li&gt;View javascript console errors&lt;/li&gt;
-  &lt;li&gt;View detailed PhantomJS debuged information&lt;/li&gt;
-  &lt;li&gt;Save screen captures to local disk&lt;/li&gt;
-  &lt;li&gt;Set viewport size&lt;/li&gt;
-  &lt;li&gt;Define screen capture x, y, width and height parameters&lt;/li&gt;
-  &lt;li&gt;Delay page rendering for a specified time&lt;/li&gt;
-  &lt;li&gt;Execute PhantomJS with command line options&lt;/li&gt;
-  &lt;li&gt;Easily build and run custom PhantomJS scripts&lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
-
-&lt;p&gt;PHP PhantomJS requires PHP &lt;strong&gt;5.3.0&lt;/strong&gt; or greater to run.&lt;/p&gt;
-
-&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
-
-&lt;p&gt;It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s &lt;code&gt;composer.json&lt;/code&gt; file:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#composer.json&lt;/span&gt;
-
-    &lt;span class=&quot;s&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;post-install-cmd&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;[&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;PhantomInstaller\\Installer::installPhantomJS&amp;quot;&lt;/span&gt;
-        &lt;span class=&quot;p-Indicator&quot;&gt;],&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;post-update-cmd&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;[&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;PhantomInstaller\\Installer::installPhantomJS&amp;quot;&lt;/span&gt;
-        &lt;span class=&quot;p-Indicator&quot;&gt;]&lt;/span&gt;
-    &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#composer.json&lt;/span&gt;
-    
-    &lt;span class=&quot;s&quot;&gt;&amp;quot;config&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;bin-dir&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;bin&amp;quot;&lt;/span&gt;
-    &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;Finally, install PHP PhantomJS from the root of your project:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;composer require &lt;span class=&quot;s2&quot;&gt;&amp;quot;jonnyw/php-phantomjs:3.*&amp;quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;If you would like to use another installation method or would like to see more detailed installation instructions, see the &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/installation.html&quot;&gt;installation&lt;/a&gt; documentation.&lt;/p&gt;
-
-&lt;h2 id=&quot;basic-usage&quot;&gt;Basic Usage&lt;/h2&gt;
-
-&lt;p&gt;The following illustrates how to make a basic GET request and output the page content:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;sd&quot;&gt;/** &lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     * @see JonnyW\PhantomJs\Message\Request &lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     **/&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;GET&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-
-    &lt;span class=&quot;sd&quot;&gt;/** &lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     * @see JonnyW\PhantomJs\Message\Response &lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     **/&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;c1&quot;&gt;// Send the request&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStatus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-
-        &lt;span class=&quot;c1&quot;&gt;// Dump the requested page content&lt;/span&gt;
-        &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;And if you would like to save a screen capture to local disk:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;sd&quot;&gt;/** &lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     * @see JonnyW\PhantomJs\Message\CaptureRequest&lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     **/&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createCaptureRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;GET&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCaptureFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/save/capture/file.jpg&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-
-    &lt;span class=&quot;sd&quot;&gt;/** &lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     * @see JonnyW\PhantomJs\Message\Response &lt;/span&gt;
-&lt;span class=&quot;sd&quot;&gt;     **/&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;c1&quot;&gt;// Send the request&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;For more detailed examples see the &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/usage.html&quot;&gt;usage&lt;/a&gt; section, or to create your own custom scripts check out the &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/advanced.html&quot;&gt;advanced&lt;/a&gt; documentation.&lt;/p&gt;
-
-</description>
-				<pubDate>Mon, 28 Jul 2014 00:00:00 +0100</pubDate>
-				<link>http://jonnnnyw.github.io/php-phantomjs/introduction.html</link>
-				<guid isPermaLink="true">http://jonnnnyw.github.io/php-phantomjs/introduction.html</guid>
+				<title>{{ post.title }}</title>
+				<description>{{ post.content | xml_escape }}</description>
+				<pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
+				<link>{{ site.BASE_PATH }}{{ post.url }}</link>
+				<guid isPermaLink="true">{{ site.BASE_PATH }}{{ post.url }}</guid>
 			</item>
-		
-			<item>
-				<title>Installation</title>
-				<description>&lt;ul&gt;
-  &lt;li&gt;&lt;a href=&quot;#prerequisites&quot;&gt;Prerequisites&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#installing-via-composer&quot;&gt;Installing via Composer&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#custom-installation&quot;&gt;Custom Installation&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#installing-from-tarball&quot;&gt;Installing from tarball&lt;/a&gt;&lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;hr /&gt;
-
-&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
-
-&lt;p&gt;PHP PhantomJS requires PHP &lt;strong&gt;5.3.0&lt;/strong&gt; or greater to run.&lt;/p&gt;
-
-&lt;h2 id=&quot;installing-via-composer&quot;&gt;Installing via Composer&lt;/h2&gt;
-
-&lt;p&gt;Install &lt;a href=&quot;https://getcomposer.org/&quot;&gt;Composer&lt;/a&gt; for your project:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl -s http://getcomposer.org/installer &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; php&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;Create a &lt;code&gt;composer.json&lt;/code&gt; file in the root of your project:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#composer.json&lt;/span&gt;
-
-    &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;require&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;jonnyw/php-phantomjs&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;3.*&amp;quot;&lt;/span&gt;
-        &lt;span class=&quot;p-Indicator&quot;&gt;},&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;config&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;bin-dir&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;bin&amp;quot;&lt;/span&gt;
-        &lt;span class=&quot;p-Indicator&quot;&gt;},&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;post-install-cmd&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;[&lt;/span&gt;
-                &lt;span class=&quot;s&quot;&gt;&amp;quot;PhantomInstaller\\Installer::installPhantomJS&amp;quot;&lt;/span&gt;
-            &lt;span class=&quot;p-Indicator&quot;&gt;],&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;post-update-cmd&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;[&lt;/span&gt;
-                &lt;span class=&quot;s&quot;&gt;&amp;quot;PhantomInstaller\\Installer::installPhantomJS&amp;quot;&lt;/span&gt;
-            &lt;span class=&quot;p-Indicator&quot;&gt;]&lt;/span&gt;
-        &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;
-    &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;It is important that you have the ‘scripts’ section shown above in your &lt;code&gt;composer.json&lt;/code&gt; file as it will install the latest version of PhantomJS for your system to your project’s bin folder. It is recommended that you create a bin folder in the root of your project as this is where the PHP PhantomJS library will look for your PhantomJS executable. If you would prefer to use a PhantomJS executable in a custom location, see the &lt;a href=&quot;#custom-installation&quot;&gt;Custom Installation&lt;/a&gt; section.&lt;/p&gt;
-
-&lt;p&gt;Finally, install the composer depedencies for your project:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;php composer.phar install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;custom-installation&quot;&gt;Custom Installation&lt;/h2&gt;
-
-&lt;p&gt;If you would prefer to use a custom install location for the PhantomJS executable, you simply need to tell the client where to find the executable file:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setPhantomJs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/phantomjs&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;blockquote&gt;
-  &lt;h4 id=&quot;important&quot;&gt;Important&lt;/h4&gt;
-  &lt;p&gt;The PHP PhantomJS library also requires a &lt;code&gt;phantomloader&lt;/code&gt; file that comes bundled with the library and is installed to the bin folder defined in your &lt;code&gt;composer.json&lt;/code&gt; file. If you are setting a custom path to the PhantomJS executable, you need to make sure that the &lt;code&gt;phantomloader&lt;/code&gt; file can be found in the bin folder it was installed to.&lt;/p&gt;
-
-  &lt;p&gt;See below if you wish to use a custom bin folder.&lt;/p&gt;
-&lt;/blockquote&gt;
-
-&lt;p&gt;If you would like composer to install all executable files to a custom bin location when installing dependencies, set the bin dir location in your project’s &lt;code&gt;composer.json&lt;/code&gt; file:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#composer.json&lt;/span&gt;
-
-    &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;config&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;bin-dir&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/path/to/your/projects/bin/dir&amp;quot;&lt;/span&gt;
-        &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;
-    &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You will need to make sure that this directory exists and is writable by Composer before running the composer install.&lt;/p&gt;
-
-&lt;p&gt;Once you have updated your bin location run composer install to install PhantomJS:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;php composer.phar install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;This should install the correct PhantomJS executable for your system and the required &lt;code&gt;phantomloader&lt;/code&gt; file to the bin locaiton you defined in your &lt;code&gt;composer.json&lt;/code&gt; file. &lt;/p&gt;
-
-&lt;p&gt;Now you need to tell the client where to find your bin folder:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
-    
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setBinDir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/bin/dir&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;installing-from-tarball&quot;&gt;Installing from tarball&lt;/h2&gt;
-
-&lt;p&gt;The PHP PhantomJS library contains several depedencies in order to function so it is recommended that you install it via composer as this will handle your dependencies for you. If you do wish to install it from a &lt;a href=&quot;https://github.com/jonnnnyw/php-phantomjs/tags&quot;&gt;tarball release&lt;/a&gt; then you will need to install the dependencies manually.&lt;/p&gt;
-
-&lt;p&gt;The PHP PhantomJS library currently requires the following depdencies:&lt;/p&gt;
-
-&lt;ul&gt;
-  &lt;li&gt;&lt;a href=&quot;https://github.com/symfony/Config&quot;&gt;Symfony Config Component&lt;/a&gt; ~2.5&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;https://github.com/symfony/Yaml&quot;&gt;Symfony YAML Component&lt;/a&gt; ~2.5&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;https://github.com/symfony/DependencyInjection&quot;&gt;Symfony Dependency Injection Component&lt;/a&gt; ~2.5&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;https://github.com/symfony/filesystem&quot;&gt;Symfony Filesystem Component&lt;/a&gt; ~2.5&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;https://github.com/fabpot/Twig&quot;&gt;Twig templating Component&lt;/a&gt; ~1.16&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;http://phantomjs.org/&quot;&gt;PhantomJS&lt;/a&gt; ~1.9&lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;p&gt;Make sure the components are in your include path and that the PhantomJS executable is installed to your projects bin folder as mentioned in the &lt;a href=&quot;#custom-installation&quot;&gt;Custom Installation&lt;/a&gt; section.&lt;/p&gt;
-</description>
-				<pubDate>Sun, 27 Jul 2014 00:00:00 +0100</pubDate>
-				<link>http://jonnnnyw.github.io/php-phantomjs/installation.html</link>
-				<guid isPermaLink="true">http://jonnnnyw.github.io/php-phantomjs/installation.html</guid>
-			</item>
-		
-			<item>
-				<title>Usage</title>
-				<description>&lt;p&gt;This page contains some common examples of how to use the PHP PhantomJS library.&lt;/p&gt;
-
-&lt;ul&gt;
-  &lt;li&gt;&lt;a href=&quot;#basic-request&quot;&gt;Basic Request&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#post-request&quot;&gt;POST Request&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#other-request-methods&quot;&gt;Other Request Methods&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#response-data&quot;&gt;Response Data&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#screen-captures&quot;&gt;Screen Captures&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#set-viewport-size&quot;&gt;Set Viewport Size&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#custom-timeout&quot;&gt;Custom Timeout&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#delay-page-render&quot;&gt;Delay Page Render&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#custom-run-options&quot;&gt;Custom Run Options&lt;/a&gt;&lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;p&gt;For more advanced customization or to load your own PhantomJS scripts, see the &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/advanced.html&quot;&gt;advanced&lt;/a&gt; documentation.&lt;/p&gt;
-
-&lt;hr /&gt;
-
-&lt;h2 id=&quot;basic-request&quot;&gt;Basic Request&lt;/h2&gt;
-
-&lt;p&gt;A basic GET request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;GET&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStatus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You can also set the URL, request method and timeout period when creating a new request instance through the message factory:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-     
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;GET&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-        
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getStatus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;post-request&quot;&gt;POST Request&lt;/h2&gt;
-
-&lt;p&gt;A basic POST request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
-        &lt;span class=&quot;s1&quot;&gt;&amp;#39;param1&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Param 1&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
-        &lt;span class=&quot;s1&quot;&gt;&amp;#39;param2&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Param 2&amp;#39;&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;POST&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setRequestData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Set post data&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;other-request-methods&quot;&gt;Other Request Methods&lt;/h2&gt;
-
-&lt;p&gt;The PHP PhantomJS library supports the following request methods:&lt;/p&gt;
-
-&lt;ul&gt;
-  &lt;li&gt;OPTIONS&lt;/li&gt;
-  &lt;li&gt;GET&lt;/li&gt;
-  &lt;li&gt;HEAD&lt;/li&gt;
-  &lt;li&gt;POST&lt;/li&gt;
-  &lt;li&gt;PUT&lt;/li&gt;
-  &lt;li&gt;DELETE&lt;/li&gt;
-  &lt;li&gt;PATCH&lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;p&gt;The request method can be set when creating a new request instance through the message factory:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;PUT&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;Or on the request instance itself:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;PATCH&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;response-data&quot;&gt;Response Data&lt;/h2&gt;
-
-&lt;p&gt;A standard response gives you access to the following interface:&lt;/p&gt;
-
-&lt;table&gt;
-  &lt;thead&gt;
-    &lt;tr&gt;
-      &lt;th style=&quot;text-align: center&quot;&gt;Accessor&lt;/th&gt;
-      &lt;th&gt;Description&lt;/th&gt;
-      &lt;th style=&quot;text-align: center&quot;&gt;Return Type&lt;/th&gt;
-    &lt;/tr&gt;
-  &lt;/thead&gt;
-  &lt;tbody&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getHeaders()&lt;/td&gt;
-      &lt;td&gt;Returns an array of all response headers.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;Array&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getHeader(&lt;em&gt;header&lt;/em&gt;)&lt;/td&gt;
-      &lt;td&gt;Returns the value for a specific response header e.g. Content-Type.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;Mixed&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getStatus()&lt;/td&gt;
-      &lt;td&gt;The response status code e.g. 200.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;Int&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getContent()&lt;/td&gt;
-      &lt;td&gt;The raw page content of the requested page.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;String&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getContentType()&lt;/td&gt;
-      &lt;td&gt;The content type of the requested page.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;String&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getUrl()&lt;/td&gt;
-      &lt;td&gt;The URL of the requested page.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;String&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getRedirectUrl()&lt;/td&gt;
-      &lt;td&gt;If the response was a redirect, this will return the redirect URL.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;String&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;isRedirect()&lt;/td&gt;
-      &lt;td&gt;Will return true if the response was a redirect or false otherwise.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;Boolean&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getConsole()&lt;/td&gt;
-      &lt;td&gt;Returns an array of any javascript errors on the requested page along with a stack trace.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;Array&lt;/td&gt;
-    &lt;/tr&gt;
-  &lt;/tbody&gt;
-&lt;/table&gt;
-
-&lt;p&gt;If the response contains a status code of 0, chances are the request failed. Check the request &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html#how-do-i-debug-a-request&quot;&gt;debug log&lt;/a&gt; for more detailed information about what may have gone wrong.&lt;/p&gt;
-
-&lt;h2 id=&quot;screen-captures&quot;&gt;Screen Captures&lt;/h2&gt;
-
-&lt;p&gt;You can save screen captures of a page to your local disk by creating a screen capture request and setting the path you wish to save the file to:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createCaptureRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/save/your/screen/capture/file.jpg&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCaptureFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You will need to make sure the directory that you are saving the file to exists and is writable by your application.&lt;/p&gt;
-
-&lt;p&gt;You can also set the width, height, x and y axis for your screen capture:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createCaptureRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/save/your/screen/capture/file.jpg&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$top&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$left&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCaptureFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCaptureDimensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;set-viewport-size&quot;&gt;Set Viewport Size&lt;/h2&gt;
-
-&lt;p&gt;You can easily set the viewport size for a request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-        
-    &lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setViewportSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;custom-timeout&quot;&gt;Custom Timeout&lt;/h2&gt;
-
-&lt;p&gt;By default, each request will timeout after 5 seconds. You can set a custom timeout period (in milliseconds) for each request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$timeout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 10 seconds&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$timeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h2 id=&quot;delay-page-render&quot;&gt;Delay Page Render&lt;/h2&gt;
-
-&lt;p&gt;Sometimes when taking screen captures you may want to wait until the page is completely loaded before saving the capture. In this instance you can set a page render delay (in seconds) for the request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createCaptureRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$delay&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 5 seconds&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setDelay&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$delay&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You can set a page render delay for standard requests also.&lt;/p&gt;
-
-&lt;h2 id=&quot;custom-run-options&quot;&gt;Custom Run Options&lt;/h2&gt;
-
-&lt;p&gt;The PhantomJS API contains a range of command line options that can be passed when executing the PhantomJS executable. These can also be passed in via the client before a request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;--load-images=true&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;--ignore-ssl-errors=true&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You can also set a path to a JSON configuration file that contains multiple PhantomJS options:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;--config=/path/to/config.json&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;See the &lt;a href=&quot;http://phantomjs.org/api/command-line.html&quot;&gt;PhantomJS Documentation&lt;/a&gt; for a full list of command line options.&lt;/p&gt;
-</description>
-				<pubDate>Sat, 26 Jul 2014 00:00:00 +0100</pubDate>
-				<link>http://jonnnnyw.github.io/php-phantomjs/usage.html</link>
-				<guid isPermaLink="true">http://jonnnnyw.github.io/php-phantomjs/usage.html</guid>
-			</item>
-		
-			<item>
-				<title>Advanced Usage</title>
-				<description>&lt;ul&gt;
-  &lt;li&gt;&lt;a href=&quot;#phantomjs-command-line-options&quot;&gt;PhantomJS command line options&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#custom-phantomjs-scripts&quot;&gt;Custom PhantomJS scripts&lt;/a&gt;
-    &lt;ul&gt;
-      &lt;li&gt;&lt;a href=&quot;#writing-a-custom-script&quot;&gt;Writing a custom script&lt;/a&gt;&lt;/li&gt;
-      &lt;li&gt;&lt;a href=&quot;#using-custom-request-parameters-in-your-script&quot;&gt;Using custom request parameters in your script&lt;/a&gt;&lt;/li&gt;
-      &lt;li&gt;&lt;a href=&quot;#loading-your-script&quot;&gt;Loading your script&lt;/a&gt;&lt;/li&gt;
-    &lt;/ul&gt;
-  &lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;hr /&gt;
-
-&lt;h2 id=&quot;phantomjs-command-line-options&quot;&gt;PhantomJS command line options&lt;/h2&gt;
-
-&lt;p&gt;The PhantomJS API contains a range of command line options that can be passed when executing the PhantomJS executable. These can also be passed in via the client before a request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;--load-images=true&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;--ignore-ssl-errors=true&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You can also set a path to a JSON configuration file that contains multiple PhantomJS options:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addOption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;--config=/path/to/config.json&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;See the &lt;a href=&quot;http://phantomjs.org/api/command-line.html&quot;&gt;PhantomJS Documentation&lt;/a&gt; for a full list of command line options.&lt;/p&gt;
-
-&lt;h2 id=&quot;custom-phantomjs-scripts&quot;&gt;Custom PhantomJS scripts&lt;/h2&gt;
-
-&lt;p&gt;In most instances you shouldn’t need to worry about the javascript files that run the PHP PhantomJS library but there may be times when you want to execute your own custom PhantomJS scripts through the client. This can be easily achieved by using the built in script loader.&lt;/p&gt;
-
-&lt;p&gt;Script files or ‘procedures’ as they are referred to in the application are closely mapped to requests. When you create a default request instance, you are essentially running the default javascript procedure that comes bundled with the application. When you create a capture request you are running the capture procedure.&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// ~/Resources/procedures/default.proc&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createCaptureRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// ~/Resources/procedures/capture.proc&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h3 id=&quot;writing-a-custom-script&quot;&gt;Writing a custom script&lt;/h3&gt;
-
-&lt;p&gt;The first step in creating your script is to create a procedure file somewhere. For the purpose of this guide we will refer to it as &lt;code&gt;my_procedure.proc&lt;/code&gt; but in reality it can be called anything you like. The only requirement is that the file extension must be &lt;code&gt;.proc&lt;/code&gt;.&lt;/p&gt;
-
-&lt;p&gt;Create the file somewhere and make sure it can be read by your application. Make a note of the path to the directory where your file is created as you will need this when loading your script which is explained later in this guide.&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;touch my_procedure.proc
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;chmod &lt;span class=&quot;m&quot;&gt;755&lt;/span&gt; my_procedure.proc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;Next open your procedure file in your text editor and write your PhantomJS script. The &lt;a href=&quot;http://phantomjs.org/quick-start.html&quot;&gt;PhantomJS documentation&lt;/a&gt; has more detailed information on writing custom scripts.&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// my_procedure.proc&lt;/span&gt;
-
-    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;webpage&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;open&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;{{ request.getUrl() }}&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;{{ request.getMethod() }}&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;{{ request.getBody() }}&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-         
-        &lt;span class=&quot;c1&quot;&gt;// It is important that you exit PhantomJS&lt;/span&gt;
-        &lt;span class=&quot;c1&quot;&gt;// when your script has run or when you&lt;/span&gt;
-        &lt;span class=&quot;c1&quot;&gt;// encounter an error&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;phantom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
-    
-    &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;blockquote&gt;
-  &lt;h4 id=&quot;important&quot;&gt;Important&lt;/h4&gt;
-  &lt;p&gt;Make sure that &lt;code&gt;phantom.exit(1);&lt;/code&gt; is always called after your script has run or if you encounter an error. This requires you to take care when handling PhantomJS errors to ensure that you exit the PhantomJS script, whether the script was successfully executed or not. If you do not call &lt;code&gt;phantom.exit(1);&lt;/code&gt; then PhantomJS will continue to run until your PHP script times out. If you find that your custom script is hanging then this is most likely the cause.&lt;/p&gt;
-&lt;/blockquote&gt;
-
-&lt;p&gt;It is a good practice to create a global error handler in your script that exits PhantomJS:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// my_procedure.proc&lt;/span&gt;
-
-    &lt;span class=&quot;nx&quot;&gt;phantom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onError&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;trace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-  
-        &lt;span class=&quot;nx&quot;&gt;phantom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
-    
-    &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h3 id=&quot;using-custom-request-parameters-in-your-script&quot;&gt;Using custom request parameters in your script&lt;/h3&gt;
-
-&lt;p&gt;Before a procedure is executed by the application it is parsed through a template parser. The PHP PhantomJS library uses the popular &lt;a href=&quot;https://github.com/fabpot/Twig&quot;&gt;Twig templating engine&lt;/a&gt;. This gives you access to all the &lt;a href=&quot;http://twig.sensiolabs.org/doc/templates.html&quot;&gt;Twig niceness&lt;/a&gt; which you can use in your custom scripts.&lt;/p&gt;
-
-&lt;p&gt;You may have noticed in the example above that we have used some Twig template tags referencing a request object e.g. &lt;code&gt;{{ request.getUrl() }}&lt;/code&gt;. This is in fact the PHP request instance that you created and passed to the client when sending your request, which is injected into the Twig template parser. As a result you gain full access to all the data contained within the request instance, via the data accessor methods.&lt;/p&gt;
-
-&lt;p&gt;A default request instance contains the following accessors:&lt;/p&gt;
-
-&lt;table&gt;
-  &lt;thead&gt;
-    &lt;tr&gt;
-      &lt;th style=&quot;text-align: center&quot;&gt;Accessor&lt;/th&gt;
-      &lt;th&gt;Description&lt;/th&gt;
-      &lt;th style=&quot;text-align: center&quot;&gt;Twig example&lt;/th&gt;
-    &lt;/tr&gt;
-  &lt;/thead&gt;
-  &lt;tbody&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getMethod()&lt;/td&gt;
-      &lt;td&gt;The request method e.g. GET.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getMethod() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getTimeout()&lt;/td&gt;
-      &lt;td&gt;The request timeout period in milliseconds.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getTimeout() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getDelay()&lt;/td&gt;
-      &lt;td&gt;The page render delay in seconds.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getDelay() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getViewportWidth()&lt;/td&gt;
-      &lt;td&gt;The viewport width.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getViewportWidth() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getViewportHeight()&lt;/td&gt;
-      &lt;td&gt;The viewport height.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getViewportHeight() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getUrl()&lt;/td&gt;
-      &lt;td&gt;The request URL.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getUrl() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getBody()&lt;/td&gt;
-      &lt;td&gt;The request body (POST, PUT).&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getBody() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getHeaders(&lt;em&gt;format&lt;/em&gt;)&lt;/td&gt;
-      &lt;td&gt;The request headers.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getHeaders(‘json’) }}&lt;/td&gt;
-    &lt;/tr&gt;
-  &lt;/tbody&gt;
-&lt;/table&gt;
-
-&lt;p&gt;A capture request contains a few additional ones:&lt;/p&gt;
-
-&lt;table&gt;
-  &lt;thead&gt;
-    &lt;tr&gt;
-      &lt;th style=&quot;text-align: center&quot;&gt;Accessor&lt;/th&gt;
-      &lt;th&gt;Description&lt;/th&gt;
-      &lt;th style=&quot;text-align: center&quot;&gt;Twig example&lt;/th&gt;
-    &lt;/tr&gt;
-  &lt;/thead&gt;
-  &lt;tbody&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getRectTop()&lt;/td&gt;
-      &lt;td&gt;The x coordinate of the capture region.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getRectTop() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getRectLeft()&lt;/td&gt;
-      &lt;td&gt;The y coordinate of the capture region.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getRectLeft() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getRectWidth()&lt;/td&gt;
-      &lt;td&gt;The width of the capture region.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getRectWidth() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getRectHeight()&lt;/td&gt;
-      &lt;td&gt;The height of the capture region.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getRectHeight() }}&lt;/td&gt;
-    &lt;/tr&gt;
-    &lt;tr&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;getCaptureFile()&lt;/td&gt;
-      &lt;td&gt;The file to save the capture to.&lt;/td&gt;
-      &lt;td style=&quot;text-align: center&quot;&gt;{{ request.getCaptureFile() }}&lt;/td&gt;
-    &lt;/tr&gt;
-  &lt;/tbody&gt;
-&lt;/table&gt;
-
-&lt;p&gt;If you would like to inject additional data into your script through custom accessors, simply extend the request class with your own:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Message\Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomRequest&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Request&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-    
-        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getSomething&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
-        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Something!&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;Now you will be able to access the data in your custom script when using your custom request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// my_procedure.proc&lt;/span&gt;
-
-    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;something&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;{{ request.getSomething() }}&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Get something&lt;/span&gt;
-    
-    &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;And to use your custom request simply create a new instance of it and pass it to the client:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CustomRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;GET&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://www.google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h3 id=&quot;loading-your-script&quot;&gt;Loading your script&lt;/h3&gt;
-
-&lt;p&gt;Now that you have your custom script and you’ve added your custom request parameters, you may be wondering how to tell the client to actually load your script. This is done by creating a procedure loader and telling it where to find your script files.&lt;/p&gt;
-
-&lt;p&gt;The service container has a factory that makes creating a new procedure loader easy:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\DependencyInjection\ServiceContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$location&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/your/procedure/directory&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$serviceContainer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ServiceContainer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$procedureLoader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$serviceContainer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;procedure_loader_factory&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
-        &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createProcedureLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-        
-    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;The client contains a chain procedure loader which lets you set multiple loaders at the same time. Ultimately this means that you can load your custom scripts while still maintaining the ability to load the default scripts if you choose. &lt;/p&gt;
-
-&lt;p&gt;Now add your procedure loader to the chain loader:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getProcedureLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$procedureLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;The last thing you need to do is to tell the request which script you want to load for that request. This is done by setting the request type to the name of your procedure file, minus the extension:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
-    
-   &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-   &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;my_procedure&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;Or if you are using a custom request as outlined in the &lt;a href=&quot;#using-custom-request-parameters-in-your-script&quot;&gt;custom request parameters&lt;/a&gt; section, you can implement a &lt;code&gt;getType()&lt;/code&gt; method which returns the name of your procedure, eliminating the need to set the request type for each request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Message\Request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomRequest&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Request&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-    
-        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
-        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;my_procedure&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;Below is a full example for clarity:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\DependencyInjection\ServiceContainer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$location&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/your/procedure/directory&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$serviceContainer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ServiceContainer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$procedureLoader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$serviceContainer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;procedure_loader_factory&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
-        &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createProcedureLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-        
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getProcedureLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;addLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$procedureLoader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;my_procedure&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;blockquote&gt;
-  &lt;h4 id=&quot;troubleshooting&quot;&gt;Troubleshooting&lt;/h4&gt;
-  &lt;p&gt;If you find that your script isn’t running or that you are receiving a status of ‘0’ back in the response, chances are you have a syntax error in you script. It pays to turn debugging on in the client &lt;code&gt;$client-&amp;gt;debug(true)&lt;/code&gt; which will then give you access to some log information through &lt;code&gt;$client-&amp;gt;getLog()&lt;/code&gt;.&lt;/p&gt;
-&lt;/blockquote&gt;
-
-&lt;p&gt;See more detailed information about &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html&quot;&gt;troubleshooting&lt;/a&gt;.&lt;/p&gt;
-</description>
-				<pubDate>Fri, 25 Jul 2014 00:00:00 +0100</pubDate>
-				<link>http://jonnnnyw.github.io/php-phantomjs/advanced.html</link>
-				<guid isPermaLink="true">http://jonnnnyw.github.io/php-phantomjs/advanced.html</guid>
-			</item>
-		
-			<item>
-				<title>Troubleshooting</title>
-				<description>&lt;ul&gt;
-  &lt;li&gt;&lt;a href=&quot;#its-not-installing-anything-to-my-bin-directory&quot;&gt;It’s not installing anything to my bin directory&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#i-am-getting-a-invalidexecutableexception-when-making-a-request&quot;&gt;I am getting a &lt;code&gt;InvalidExecutableException&lt;/code&gt; when making a request&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#i-am-getting-a-notwritableexception-when-making-a-request&quot;&gt;I am getting a &lt;code&gt;NotWritableException&lt;/code&gt; when making a request&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#why-do-i-need-the-phantomloader-file&quot;&gt;Why do I need the &lt;code&gt;phantomloader&lt;/code&gt; file?&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#why-am-i-getting-a-status-code-of-0-in-the-response&quot;&gt;Why am I getting a status code of 0 in the response?&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#its-not-saving-my-screenshots&quot;&gt;It’s not saving my screenshots&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#can-i-set-the-screenshot-size&quot;&gt;Can I set the screenshot size?&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#can-i-set-the-viewport-size&quot;&gt;Can I set the viewport size?&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#how-do-i-debug-a-request&quot;&gt;How do I debug a request?&lt;/a&gt;&lt;/li&gt;
-  &lt;li&gt;&lt;a href=&quot;#i-am-getting-syntaxerror-parse-error-in-the-debug-log&quot;&gt;I am getting &lt;code&gt;SyntaxError: Parse error&lt;/code&gt; in the debug log&lt;/a&gt;&lt;/li&gt;
-&lt;/ul&gt;
-
-&lt;hr /&gt;
-
-&lt;h4 id=&quot;its-not-installing-anything-to-my-bin-directory&quot;&gt;It’s not installing anything to my bin directory&lt;/h4&gt;
-
-&lt;p&gt;When installing via composer, as outlined in the &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/installation.html&quot;&gt;installation guide&lt;/a&gt;, it is recommended that you define the location of the bin folder for your project. This can be done by adding the following to your &lt;code&gt;composer.json&lt;/code&gt; file:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;c1&quot;&gt;#composer.json&lt;/span&gt;
-
-    &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;s&quot;&gt;&amp;quot;config&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;
-            &lt;span class=&quot;s&quot;&gt;&amp;quot;bin-dir&amp;quot;&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/path/to/your/projects/bin/dir&amp;quot;&lt;/span&gt;
-        &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;
-    &lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You need to make sure that this directory exists and is writable before you install your composer depedencies.&lt;/p&gt;
-
-&lt;p&gt;Once you have defined your bin folder in your &lt;code&gt;composer.json&lt;/code&gt; file, run composer install from the root of your project:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;php composer.phar install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;This should install 2 files to your bin folder: &lt;code&gt;phantomjs&lt;/code&gt; and &lt;code&gt;phantomloader&lt;/code&gt;. If you do not have these 2 files in your bin folder then check that the folder is writable and run composer install again.&lt;/p&gt;
-
-&lt;blockquote&gt;
-  &lt;h4 id=&quot;note&quot;&gt;Note&lt;/h4&gt;
-  &lt;p&gt;If you do not define a bin directory in your &lt;code&gt;composer.json&lt;/code&gt; file then the default install location will be &lt;code&gt;vendor/bin/&lt;/code&gt;. If you choose to not set a bin folder path then you will need to make sure that this path is set in the client by calling &lt;code&gt;$client-&amp;gt;setBinDir(&#39;vendor/bin&#39;);&lt;/code&gt; before making a request.&lt;/p&gt;
-&lt;/blockquote&gt;
-
-&lt;h4 id=&quot;i-am-getting-a-invalidexecutableexception-when-making-a-request&quot;&gt;I am getting a &lt;code&gt;InvalidExecutableException&lt;/code&gt; when making a request&lt;/h4&gt;
-
-&lt;p&gt;If you have installed via composer, as outlined in the &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/installation.html&quot;&gt;installation guide&lt;/a&gt;, then you should have 2 files installed in either the &lt;code&gt;bin&lt;/code&gt; or &lt;code&gt;vendor/bin/&lt;/code&gt; directory, in the root of your project. These files are called &lt;code&gt;phantomjs&lt;/code&gt; and &lt;code&gt;phantomloader&lt;/code&gt;. &lt;/p&gt;
-
-&lt;p&gt;Check that these files exist and are executable by your application. If they do not exist, see &lt;a href=&quot;#its-not-installing-anything-to-my-bin-directory&quot;&gt;It’s not installing anything to my bin directory&lt;/a&gt;.&lt;/p&gt;
-
-&lt;p&gt;If the PHP PhantomJS library cannot locate either of these files then it will throw a &lt;code&gt;InvalidExecutableException&lt;/code&gt;. The message in the exception should tell you which one it can’t execute. If both of these files exist and they are executable by your application, you may need to set the path to the directory that these files live in before making a request:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; 
-    
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setBinDir&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/bin/dir&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h4 id=&quot;i-am-getting-a-notwritableexception-when-making-a-request&quot;&gt;I am getting a &lt;code&gt;NotWritableException&lt;/code&gt; when making a request&lt;/h4&gt;
-
-&lt;p&gt;When making a request, the PHP PhantomJS library compiles a temporary script file to your system’s tmp folder. The location of this folder is determined through the use of the &lt;code&gt;sys_get_temp_dir()&lt;/code&gt; function. If this directory is not writable by your application then you will receive this exception.&lt;/p&gt;
-
-&lt;h4 id=&quot;why-do-i-need-the-phantomloader-file&quot;&gt;Why do I need the &lt;code&gt;phantomloader&lt;/code&gt; file?&lt;/h4&gt;
-
-&lt;p&gt;A proxy loader file is used get around a quirk that PhantomJS has when it encounters a syntax error in a script file. By default, if PhantomJS encounters a syntax error when loading a script file it will not exit execution. This means that PHP PhantomJS will continue to wait for a response from PhantomJS until PHP reaches its script execution timeout period. This also means you won’t get any debug information informing you that the PhantomJS script has a syntax error.&lt;/p&gt;
-
-&lt;p&gt;To get around this, script files are loaded through a loader script. This handles the event of a syntax error and ensures that PhantomJS exits when an error is encountered.&lt;/p&gt;
-
-&lt;p&gt;The &lt;code&gt;phantomloader&lt;/code&gt; file is required in order for the PHP PhantomJS library to run so please make sure that it was installed to your bin folder and is readable by your application.&lt;/p&gt;
-
-&lt;p&gt;Another reason for getting this exception is when you are trying to save screenshots. See &lt;a href=&quot;#its-not-saving-my-screenshots&quot;&gt;It’s not saving my screenshots&lt;/a&gt;.&lt;/p&gt;
-
-&lt;h4 id=&quot;why-am-i-getting-a-status-code-of-0-in-the-response&quot;&gt;Why am I getting a status code of 0 in the response?&lt;/h4&gt;
-
-&lt;p&gt;A status code of 0 in the response object generally means the request did not complete successfully. This could mean that the URL you are requesting did not return a response or that something happened when making the request that did not raise an error in the PHP PhantomJS library.&lt;/p&gt;
-
-&lt;p&gt;Becuase and exception was not thrown, chances are the issue is with PhantomJS itself or at the endpoint you are calling.&lt;/p&gt;
-
-&lt;p&gt;One possible reason for this is that your request has timed out before a response was returned from the endpoint that you are requesting. Depending on what you are requesting, some websites seem to take a while to return a response. An example of this is &lt;a href=&quot;https://myspace.com/&quot;&gt;myspace.com&lt;/a&gt; which, at the time of writing this, takes a considerable amount of time resolve through PhantomJS.&lt;/p&gt;
-
-&lt;p&gt;To work around this you can try increasing the timeout period in the PHP PhantomJS client:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$timeout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// 20 seconds&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$timeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;If you are still having a problem then you should enable debugging, before you make the request, and check the debug log. This contains a dump of information from PhantomJS which could help to track down why you are not getting a response.&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;debug&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Set debug flag&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-        
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Output log&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You can also try running a test script through your PhantomJS executable, from the command line, to see if you get a valid response back. Save the following script somewhere:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;//test-script.js&lt;/span&gt;
-
-    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;webpage&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;YOUR REQUEST URL&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Change this to the URL you want to request&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
-
-    &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onResourceReceived&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
-
-    &lt;span class=&quot;nx&quot;&gt;phantom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;onError&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;trace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-  
-        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;trace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;phantom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
- 
-    &lt;span class=&quot;nx&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;open&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;GET&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
-        
-        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;JSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stringify&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
-        &lt;span class=&quot;nx&quot;&gt;phantom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;And then, assuming you have saved the script above to &lt;code&gt;test-script.js&lt;/code&gt; in the root of your project and your PhantomJS executable is located at &lt;code&gt;bin/phantomjs&lt;/code&gt;, run the following:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-
-    &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;bin/phantomjs ./test-script.js&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You should see an output of the response from PhantomJS:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#bash&lt;/span&gt;
-
-    success
-    &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;contentType&amp;quot;&lt;/span&gt;:&lt;span class=&quot;s2&quot;&gt;&amp;quot;text/javascript; charset=UTF-8&amp;quot;&lt;/span&gt;, &lt;span class=&quot;s2&quot;&gt;&amp;quot;headers&amp;quot;&lt;/span&gt;: ...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;If you don’t see &lt;code&gt;success&lt;/code&gt; followed by a JSON encoded response object then there is something the with the URL you are requesting or your PhantomJS executable. Try reinstalling PhantomJS. If you see &lt;code&gt;fail&lt;/code&gt; instead of &lt;code&gt;success&lt;/code&gt;, chances are the URL you are requesting is invalid or not resolving.&lt;/p&gt;
-
-&lt;h4 id=&quot;its-not-saving-my-screenshots&quot;&gt;It’s not saving my screenshots&lt;/h4&gt;
-
-&lt;p&gt;When making a capture request you need to make sure that you are setting the file location that you want the screenshot saved to, including the filename:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createCaptureRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/save/your/screen/capture/file.jpg&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCaptureFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Set the capture file&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;The file itself does not need to exist but the parent directory must exist and be writable by your application. Check that your application has permissions to write files to the directory you are setting for your screen captures.&lt;/p&gt;
-
-&lt;h4 id=&quot;can-i-set-the-screenshot-size&quot;&gt;Can I set the screenshot size?&lt;/h4&gt;
-
-&lt;p&gt;Yes, you can set the width and height of your capture along with the x and y coordinates of where the capture should start from:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createCaptureRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/path/to/save/your/screen/capture/file.jpg&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$top&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$left&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCaptureFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setCaptureDimensions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h4 id=&quot;can-i-set-the-viewport-size&quot;&gt;Can I set the viewport size?&lt;/h4&gt;
-
-&lt;p&gt;Yes, you can set the viewport dimensions on both regular and capture requests:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-        
-    &lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setViewportSize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Set viewport size&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h4 id=&quot;how-do-i-debug-a-request&quot;&gt;How do I debug a request?&lt;/h4&gt;
-
-&lt;p&gt;By setting the debug flag to &lt;code&gt;true&lt;/code&gt; on the client, you can get a dump of information output from PhantomJS along with some info events added by the PHP PhantomJS library:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;debug&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Set debug flag&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-        
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Output log&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;p&gt;You can also get any javacript console errors along with a stack trace from the URL you are calling, in the response object:&lt;/p&gt;
-
-&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt;
-
-    &lt;span class=&quot;k&quot;&gt;use&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;JonnyW\PhantomJs\Client&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-    
-    &lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://google.com&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getMessageFactory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;createResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
-        
-    &lt;span class=&quot;nv&quot;&gt;$client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
-    
-    &lt;span class=&quot;nb&quot;&gt;var_dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getConsole&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Outputs array of console errors and stack trace&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
-
-&lt;h4 id=&quot;i-am-getting-syntaxerror-parse-error-in-the-debug-log&quot;&gt;I am getting &lt;code&gt;SyntaxError: Parse error&lt;/code&gt; in the debug log&lt;/h4&gt;
-
-&lt;p&gt;You will only get this error if the script file that is being run by PhantomJS has a syntax error. If you are writing your own &lt;a href=&quot;http://jonnnnyw.github.io/php-phantomjs/advanced.html#custom-phantomjs-scripts&quot;&gt;custom scripts&lt;/a&gt; then try setting the &lt;a href=&quot;#how-do-i-debug-a-request&quot;&gt;debug flag&lt;/a&gt; which &lt;em&gt;should&lt;/em&gt; print some more detailed information in the debug log. Also check that you aren’t setting any parameters to &lt;code&gt;null&lt;/code&gt; in your request object as this could be causing a javascript error due to javascript variables being set to nothing e.g. &lt;code&gt;var width = ,&lt;/code&gt;.&lt;/p&gt;
-</description>
-				<pubDate>Wed, 23 Jul 2014 00:00:00 +0100</pubDate>
-				<link>http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html</link>
-				<guid isPermaLink="true">http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html</guid>
-			</item>
-		
+		{% endfor %}
 	</channel>
 </rss>

+ 143 - 49
_site/index.html

@@ -43,60 +43,104 @@
 </head>
 
 <body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
+    
+     
+
+	<nav class="navbar navbar-default visible-xs" role="navigation" id="global-nav">
 		<!-- Brand and toggle get grouped for better mobile display -->
 		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+			<button type="button" class="navbar-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-main">
 				<span class="sr-only">Toggle navigation</span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 				<span class="icon-bar"></span>
 			</button>
 			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
+			<button type="button" class="navbar-toggle version-toggle" data-parent="#global-nav" data-toggle="collapse" data-target="#navbar-collapse-version">
+				<span class="sr-only">Toggle navigation</span>
+				<span class="fa fa-terminal"><b>4.0</b> version</</span>
+			</button>
     		
 			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
 				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
 				PHP PhantomJs
 			</a>
 		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
+        
+        <div class="panel">
+            <!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-version">
+    			<ul class="nav navbar-nav">
+    				<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="Version 4.0" class="active"><b>4.0</b> version</a></li>
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="Version 3.0"><b>3.0</b> version</a></li>
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
+        <div class="panel">
+    		<!-- Collect the nav links, forms, and other content for toggling -->
+    		<div class="collapse navbar-collapse" id="navbar-collapse-main">
+    			<ul class="nav navbar-nav">
+        			
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/">Introduction</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/">Installation</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/">Usage</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/">Custom Scripts</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/">Caching</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/">Debugging</a></li>
+                    
+                    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/">Troubleshooting</a></li>
+                    
+    			</ul>
+    		</div><!-- /.navbar-collapse -->
+        </div>
+        
 	</nav>
-
+    
+	<!-- version-menu-dropdown -->
+	<div class="btn-group hidden-xs" id="nav-version">
+		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+			<i class="fa fa-terminal"><b>4.0</b> version</i>
+		</button>
+		<ul class="dropdown-menu" role="menu">
+		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/" title="4.0 version" class="active"><b>4.0</b> version</a></li>
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/3.0/" title="3.0 version"><b>3.0</b> version</a></li>
+			<li class="divider"></li>
+		</ul>
+	</div>
+    
 	<!-- nav-menu-dropdown -->
 	<div class="btn-group hidden-xs" id="nav-menu">
 		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
 			<i class="fa fa-bars"></i>
 		</button>
 		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+		    
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/"><i class="fa fa-folder"></i>Introduction</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/"><i class="fa fa-folder"></i>Installation</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/3-usage/"><i class="fa fa-folder"></i>Usage</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/4-custom-scripts/"><i class="fa fa-folder"></i>Custom Scripts</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/5-caching/"><i class="fa fa-folder"></i>Caching</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/6-debugging/"><i class="fa fa-folder"></i>Debugging</a></li>
+			
+			<li><a href="http://jonnnnyw.github.io/php-phantomjs/4.0/7-troubleshooting/"><i class="fa fa-folder"></i>Troubleshooting</a></li>
+			
 			<li class="divider"></li>
 			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
 		</ul>
 	</div>
 
+
 	<div class="col-sm-3 sidebar hidden-xs">
 		<! -- sidebar.html -->
 <header class="sidebar-header" role="banner">
@@ -120,7 +164,7 @@
 		
 		<li>
             <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
+                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20"></iframe>
 		</li>
 		
 		
@@ -136,7 +180,10 @@
 
 	</div>
 
+    <p id="version-notice">You are currently viewing version <span>4.0</span> documentation.</p>
+
 	<div class="col-sm-9 col-sm-offset-3">
+
 		
 
 
@@ -148,7 +195,7 @@
 
   <div>
     
-    <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.</p>
+    <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures and PDF output.</p>
 
 <h2 id="feature-list">Feature List</h2>
 
@@ -160,6 +207,7 @@ code etc.</li>
   <li>View javascript console errors</li>
   <li>View detailed PhantomJS debuged information</li>
   <li>Save screen captures to local disk</li>
+  <li>Output web pages to PDF document</li>
   <li>Set viewport size</li>
   <li>Define screen capture x, y, width and height parameters</li>
   <li>Delay page rendering for a specified time</li>
@@ -175,7 +223,8 @@ code etc.</li>
 
 <p>It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s <code>composer.json</code> file:</p>
 
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    
+    <span class="c1">#composer.json</span>
 
     <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
         <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
@@ -184,29 +233,39 @@ code etc.</li>
         <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
             <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
         <span class="p-Indicator">]</span>
-    <span class="p-Indicator">}</span></code></pre></div>
+    <span class="p-Indicator">}</span>
+    </code></pre></figure>
 
 <p>This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:</p>
 
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
+<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml">    
+    <span class="c1">#composer.json</span>
     
     <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
         <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
-    <span class="p-Indicator">}</span></code></pre></div>
+    <span class="p-Indicator">}</span></code></pre></figure>
 
 <p>Finally, install PHP PhantomJS from the root of your project:</p>
 
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
+<figure class="highlight"><pre><code class="language-bash" data-lang="bash">    
+    <span class="c">#bash</span>
     
-    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:3.*&quot;</span></code></pre></div>
+    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:4.*&quot;</span></code></pre></figure>
+
+<p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/installation/">installation</a> documentation.</p>
+
+<blockquote>
+  <h4 id="important">Important</h4>
+  <p>By default the PhantomJS library will look for the PhantomJS executable in the bin folder relative to where your script is running <code>~/bin/phantomjs</code>. If the executable cannot be found or if the path to your PhantomJS executable differs from the default location, for example you have installed PhantomJS globally, you will need to define the path to your PhantomJS executable manually.</p>
 
-<p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">installation</a> documentation.</p>
+  <p><code>$client-&gt;getEngine()-&gt;setPath('/path/to/phantomjs');</code></p>
+</blockquote>
 
 <h2 id="basic-usage">Basic Usage</h2>
 
 <p>The following illustrates how to make a basic GET request and output the page content:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
 
@@ -215,7 +274,7 @@ code etc.</li>
     <span class="sd">/** </span>
 <span class="sd">     * @see JonnyW\PhantomJs\Message\Request </span>
 <span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
 
     <span class="sd">/** </span>
 <span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
@@ -229,21 +288,55 @@ code etc.</li>
 
         <span class="c1">// Dump the requested page content</span>
         <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
+    <span class="p">}</span>
+    </code></pre></figure>
 
-<p>And if you would like to save a screen capture to local disk:</p>
+<p>Saving a screen capture to local disk:</p>
 
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
 
     <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
 
     <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
+    
+    <span class="nv">$width</span>  <span class="o">=</span> <span class="mi">800</span><span class="p">;</span>
+    <span class="nv">$height</span> <span class="o">=</span> <span class="mi">600</span><span class="p">;</span>
+    <span class="nv">$top</span>    <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    <span class="nv">$left</span>   <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+    
     <span class="sd">/** </span>
 <span class="sd">     * @see JonnyW\PhantomJs\Message\CaptureRequest</span>
 <span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/capture/file.jpg&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOutputFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/capture/file.jpg&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setViewportSize</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureDimensions</span><span class="p">(</span><span class="nv">$width</span><span class="p">,</span> <span class="nv">$height</span><span class="p">,</span> <span class="nv">$top</span><span class="p">,</span> <span class="nv">$left</span><span class="p">);</span>
+
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
+<span class="sd">     **/</span>
+    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
+
+    <span class="c1">// Send the request</span>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
+    </code></pre></figure>
+
+<p>Outputting a page as PDF:</p>
+
+<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="x">    </span><span class="cp">&lt;?php</span>
+
+    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
+
+    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
+
+    <span class="sd">/** </span>
+<span class="sd">     * @see JonnyW\PhantomJs\Message\PdfRequest</span>
+<span class="sd">     **/</span>
+    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createPdfRequest</span><span class="p">(</span><span class="s1">&#39;http://jonnyw.me&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOutputFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/pdf/document.pdf&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setFormat</span><span class="p">(</span><span class="s1">&#39;A4&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setOrientation</span><span class="p">(</span><span class="s1">&#39;landscape&#39;</span><span class="p">);</span>
+    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setMargin</span><span class="p">(</span><span class="s1">&#39;1cm&#39;</span><span class="p">);</span>
 
     <span class="sd">/** </span>
 <span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
@@ -251,9 +344,10 @@ code etc.</li>
     <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
 
     <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
+    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
+    </code></pre></figure>
 
-<p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">usage</a> section, or to create your own custom scripts check out the <a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">advanced</a> documentation.</p>
+<p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/usage/">usage</a> section, or you can <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/custom-scripts/">create your own custom scripts</a>.</p>
 
 
     
@@ -265,7 +359,7 @@ code etc.</li>
   <ul class="pager"> 
       
       <li class="next">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html" title="Installation">Installation &rarr;</a>
+        <a href="http://jonnnnyw.github.io/php-phantomjs/4.0/2-installation/" title="Installation">Installation &rarr;</a>
       </li>
       
   </ul>
@@ -280,7 +374,7 @@ code etc.</li>
 		<footer>
 			<hr/>
 			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
+				&copy; 2015 PHP PhantomJs
 			</p>
 		</footer>
 	</div>

+ 0 - 294
_site/page2/index.html

@@ -1,294 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-	<meta charset="utf-8">
-	<title>PHP PhantomJS</title>
-	
-	<meta name="author" content="Jonny W">
-
-	<!-- Enable responsive viewport -->
-	<meta name="viewport" content="width=device-width, initial-scale=1.0">
-
-	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
-	<!--[if lt IE 9]>
-	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
-	<![endif]-->
-
-	<!-- Le styles -->
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
-
-	<!-- Le fav and touch icons -->
-	<!-- Update these with your own images
-	<link rel="shortcut icon" href="images/favicon.ico">
-	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
-	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
-	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-	-->
-
-	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
-
-   <script>
-        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-        
-        ga('create', 'UA-53289013-1', 'auto');
-        ga('send', 'pageview');
-    </script>
-
-</head>
-
-<body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
-		<!-- Brand and toggle get grouped for better mobile display -->
-		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
-				<span class="sr-only">Toggle navigation</span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-			</button>
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
-    		
-			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
-				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
-				PHP PhantomJs
-			</a>
-		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
-	</nav>
-
-	<!-- nav-menu-dropdown -->
-	<div class="btn-group hidden-xs" id="nav-menu">
-		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
-			<i class="fa fa-bars"></i>
-		</button>
-		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
-			<li class="divider"></li>
-			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
-		</ul>
-	</div>
-
-	<div class="col-sm-3 sidebar hidden-xs">
-		<! -- sidebar.html -->
-<header class="sidebar-header" role="banner">
-	<a href="http://jonnnnyw.github.io/php-phantomjs/">
-		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
-	</a>
-	<h3 class="title">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
-    </h3>
-</header>
-
-
-<div id="bio" class="text-center">
-	Run PhantomJS scripts through PHP
-</div>
-
-
-<div id="contact-list" class="text-center">
-
-	<ul class="list-unstyled list-inline">
-		
-		<li>
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-		
-		<li>
-			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-	</ul>
-
-</div>
-<! -- sidebar.html end -->
-
-	</div>
-
-	<div class="col-sm-9 col-sm-offset-3">
-		
-
-
-<div class="page-header">
-  <h1>Introduction </h1>
-</div>
-
-<article class="home">
-
-  <div>
-    
-    <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.</p>
-
-<h2 id="feature-list">Feature List</h2>
-
-<ul>
-  <li>Load webpages through the PhantomJS headless browser</li>
-  <li>View detailed response data including page content, headers, status<br />
-code etc.</li>
-  <li>Handle redirects</li>
-  <li>View javascript console errors</li>
-  <li>View detailed PhantomJS debuged information</li>
-  <li>Save screen captures to local disk</li>
-  <li>Set viewport size</li>
-  <li>Define screen capture x, y, width and height parameters</li>
-  <li>Delay page rendering for a specified time</li>
-  <li>Execute PhantomJS with command line options</li>
-  <li>Easily build and run custom PhantomJS scripts</li>
-</ul>
-
-<h2 id="prerequisites">Prerequisites</h2>
-
-<p>PHP PhantomJS requires PHP <strong>5.3.0</strong> or greater to run.</p>
-
-<h2 id="installation">Installation</h2>
-
-<p>It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s <code>composer.json</code> file:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-
-    <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">],</span>
-        <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">]</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-    
-    <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>Finally, install PHP PhantomJS from the root of your project:</p>
-
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
-    
-    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:3.*&quot;</span></code></pre></div>
-
-<p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">installation</a> documentation.</p>
-
-<h2 id="basic-usage">Basic Usage</h2>
-
-<p>The following illustrates how to make a basic GET request and output the page content:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Request </span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
-
-    <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
-
-        <span class="c1">// Dump the requested page content</span>
-        <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
-
-<p>And if you would like to save a screen capture to local disk:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\CaptureRequest</span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/capture/file.jpg&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
-
-<p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">usage</a> section, or to create your own custom scripts check out the <a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">advanced</a> documentation.</p>
-
-
-    
-  </div>
-  
-  <div class="clearfix"></div>
-  <hr/>
-
-  <ul class="pager"> 
-      
-      <li class="next">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html" title="Installation">Installation &rarr;</a>
-      </li>
-      
-  </ul>
-
-</article>
-
-
-
-
-
-
-		<footer>
-			<hr/>
-			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
-			</p>
-		</footer>
-	</div>
-
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
-	
-</body>
-</html>
-

+ 0 - 294
_site/page3/index.html

@@ -1,294 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-	<meta charset="utf-8">
-	<title>PHP PhantomJS</title>
-	
-	<meta name="author" content="Jonny W">
-
-	<!-- Enable responsive viewport -->
-	<meta name="viewport" content="width=device-width, initial-scale=1.0">
-
-	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
-	<!--[if lt IE 9]>
-	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
-	<![endif]-->
-
-	<!-- Le styles -->
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
-
-	<!-- Le fav and touch icons -->
-	<!-- Update these with your own images
-	<link rel="shortcut icon" href="images/favicon.ico">
-	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
-	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
-	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-	-->
-
-	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
-
-   <script>
-        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-        
-        ga('create', 'UA-53289013-1', 'auto');
-        ga('send', 'pageview');
-    </script>
-
-</head>
-
-<body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
-		<!-- Brand and toggle get grouped for better mobile display -->
-		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
-				<span class="sr-only">Toggle navigation</span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-			</button>
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
-    		
-			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
-				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
-				PHP PhantomJs
-			</a>
-		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
-	</nav>
-
-	<!-- nav-menu-dropdown -->
-	<div class="btn-group hidden-xs" id="nav-menu">
-		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
-			<i class="fa fa-bars"></i>
-		</button>
-		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
-			<li class="divider"></li>
-			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
-		</ul>
-	</div>
-
-	<div class="col-sm-3 sidebar hidden-xs">
-		<! -- sidebar.html -->
-<header class="sidebar-header" role="banner">
-	<a href="http://jonnnnyw.github.io/php-phantomjs/">
-		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
-	</a>
-	<h3 class="title">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
-    </h3>
-</header>
-
-
-<div id="bio" class="text-center">
-	Run PhantomJS scripts through PHP
-</div>
-
-
-<div id="contact-list" class="text-center">
-
-	<ul class="list-unstyled list-inline">
-		
-		<li>
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-		
-		<li>
-			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-	</ul>
-
-</div>
-<! -- sidebar.html end -->
-
-	</div>
-
-	<div class="col-sm-9 col-sm-offset-3">
-		
-
-
-<div class="page-header">
-  <h1>Introduction </h1>
-</div>
-
-<article class="home">
-
-  <div>
-    
-    <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.</p>
-
-<h2 id="feature-list">Feature List</h2>
-
-<ul>
-  <li>Load webpages through the PhantomJS headless browser</li>
-  <li>View detailed response data including page content, headers, status<br />
-code etc.</li>
-  <li>Handle redirects</li>
-  <li>View javascript console errors</li>
-  <li>View detailed PhantomJS debuged information</li>
-  <li>Save screen captures to local disk</li>
-  <li>Set viewport size</li>
-  <li>Define screen capture x, y, width and height parameters</li>
-  <li>Delay page rendering for a specified time</li>
-  <li>Execute PhantomJS with command line options</li>
-  <li>Easily build and run custom PhantomJS scripts</li>
-</ul>
-
-<h2 id="prerequisites">Prerequisites</h2>
-
-<p>PHP PhantomJS requires PHP <strong>5.3.0</strong> or greater to run.</p>
-
-<h2 id="installation">Installation</h2>
-
-<p>It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s <code>composer.json</code> file:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-
-    <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">],</span>
-        <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">]</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-    
-    <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>Finally, install PHP PhantomJS from the root of your project:</p>
-
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
-    
-    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:3.*&quot;</span></code></pre></div>
-
-<p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">installation</a> documentation.</p>
-
-<h2 id="basic-usage">Basic Usage</h2>
-
-<p>The following illustrates how to make a basic GET request and output the page content:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Request </span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
-
-    <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
-
-        <span class="c1">// Dump the requested page content</span>
-        <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
-
-<p>And if you would like to save a screen capture to local disk:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\CaptureRequest</span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/capture/file.jpg&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
-
-<p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">usage</a> section, or to create your own custom scripts check out the <a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">advanced</a> documentation.</p>
-
-
-    
-  </div>
-  
-  <div class="clearfix"></div>
-  <hr/>
-
-  <ul class="pager"> 
-      
-      <li class="next">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html" title="Installation">Installation &rarr;</a>
-      </li>
-      
-  </ul>
-
-</article>
-
-
-
-
-
-
-		<footer>
-			<hr/>
-			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
-			</p>
-		</footer>
-	</div>
-
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
-	
-</body>
-</html>
-

+ 0 - 294
_site/page4/index.html

@@ -1,294 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-	<meta charset="utf-8">
-	<title>PHP PhantomJS</title>
-	
-	<meta name="author" content="Jonny W">
-
-	<!-- Enable responsive viewport -->
-	<meta name="viewport" content="width=device-width, initial-scale=1.0">
-
-	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
-	<!--[if lt IE 9]>
-	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
-	<![endif]-->
-
-	<!-- Le styles -->
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
-
-	<!-- Le fav and touch icons -->
-	<!-- Update these with your own images
-	<link rel="shortcut icon" href="images/favicon.ico">
-	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
-	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
-	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-	-->
-
-	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
-
-   <script>
-        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-        
-        ga('create', 'UA-53289013-1', 'auto');
-        ga('send', 'pageview');
-    </script>
-
-</head>
-
-<body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
-		<!-- Brand and toggle get grouped for better mobile display -->
-		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
-				<span class="sr-only">Toggle navigation</span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-			</button>
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
-    		
-			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
-				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
-				PHP PhantomJs
-			</a>
-		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
-	</nav>
-
-	<!-- nav-menu-dropdown -->
-	<div class="btn-group hidden-xs" id="nav-menu">
-		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
-			<i class="fa fa-bars"></i>
-		</button>
-		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
-			<li class="divider"></li>
-			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
-		</ul>
-	</div>
-
-	<div class="col-sm-3 sidebar hidden-xs">
-		<! -- sidebar.html -->
-<header class="sidebar-header" role="banner">
-	<a href="http://jonnnnyw.github.io/php-phantomjs/">
-		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
-	</a>
-	<h3 class="title">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
-    </h3>
-</header>
-
-
-<div id="bio" class="text-center">
-	Run PhantomJS scripts through PHP
-</div>
-
-
-<div id="contact-list" class="text-center">
-
-	<ul class="list-unstyled list-inline">
-		
-		<li>
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-		
-		<li>
-			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-	</ul>
-
-</div>
-<! -- sidebar.html end -->
-
-	</div>
-
-	<div class="col-sm-9 col-sm-offset-3">
-		
-
-
-<div class="page-header">
-  <h1>Introduction </h1>
-</div>
-
-<article class="home">
-
-  <div>
-    
-    <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.</p>
-
-<h2 id="feature-list">Feature List</h2>
-
-<ul>
-  <li>Load webpages through the PhantomJS headless browser</li>
-  <li>View detailed response data including page content, headers, status<br />
-code etc.</li>
-  <li>Handle redirects</li>
-  <li>View javascript console errors</li>
-  <li>View detailed PhantomJS debuged information</li>
-  <li>Save screen captures to local disk</li>
-  <li>Set viewport size</li>
-  <li>Define screen capture x, y, width and height parameters</li>
-  <li>Delay page rendering for a specified time</li>
-  <li>Execute PhantomJS with command line options</li>
-  <li>Easily build and run custom PhantomJS scripts</li>
-</ul>
-
-<h2 id="prerequisites">Prerequisites</h2>
-
-<p>PHP PhantomJS requires PHP <strong>5.3.0</strong> or greater to run.</p>
-
-<h2 id="installation">Installation</h2>
-
-<p>It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s <code>composer.json</code> file:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-
-    <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">],</span>
-        <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">]</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-    
-    <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>Finally, install PHP PhantomJS from the root of your project:</p>
-
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
-    
-    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:3.*&quot;</span></code></pre></div>
-
-<p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">installation</a> documentation.</p>
-
-<h2 id="basic-usage">Basic Usage</h2>
-
-<p>The following illustrates how to make a basic GET request and output the page content:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Request </span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
-
-    <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
-
-        <span class="c1">// Dump the requested page content</span>
-        <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
-
-<p>And if you would like to save a screen capture to local disk:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\CaptureRequest</span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/capture/file.jpg&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
-
-<p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">usage</a> section, or to create your own custom scripts check out the <a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">advanced</a> documentation.</p>
-
-
-    
-  </div>
-  
-  <div class="clearfix"></div>
-  <hr/>
-
-  <ul class="pager"> 
-      
-      <li class="next">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html" title="Installation">Installation &rarr;</a>
-      </li>
-      
-  </ul>
-
-</article>
-
-
-
-
-
-
-		<footer>
-			<hr/>
-			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
-			</p>
-		</footer>
-	</div>
-
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
-	
-</body>
-</html>
-

+ 0 - 294
_site/page5/index.html

@@ -1,294 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-	<meta charset="utf-8">
-	<title>PHP PhantomJS</title>
-	
-	<meta name="author" content="Jonny W">
-
-	<!-- Enable responsive viewport -->
-	<meta name="viewport" content="width=device-width, initial-scale=1.0">
-
-	<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
-	<!--[if lt IE 9]>
-	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
-	<![endif]-->
-
-	<!-- Le styles -->
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/resources/syntax/syntax.css" rel="stylesheet">
-	<link href="http://jonnnnyw.github.io/php-phantomjs/assets/css/style.css" rel="stylesheet">
-
-	<!-- Le fav and touch icons -->
-	<!-- Update these with your own images
-	<link rel="shortcut icon" href="images/favicon.ico">
-	<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
-	<link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
-	<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
-	-->
-
-	<link rel="alternate" type="application/rss+xml" title="" href="http://jonnnnyw.github.io/php-phantomjs/feed.xml">
-
-   <script>
-        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
-        
-        ga('create', 'UA-53289013-1', 'auto');
-        ga('send', 'pageview');
-    </script>
-
-</head>
-
-<body>
-	<nav class="navbar navbar-default visible-xs" role="navigation">
-		<!-- Brand and toggle get grouped for better mobile display -->
-		<div class="navbar-header">
-			<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
-				<span class="sr-only">Toggle navigation</span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-				<span class="icon-bar"></span>
-			</button>
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link last"></iframe>
-    		
-			
-			
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="85" height="20" class="nav-link"></iframe>
-    		
-    		
-			<a class="navbar-brand" href="http://jonnnnyw.github.io/php-phantomjs/">
-				<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs-small.png" class="img-circle" />
-				PHP PhantomJs
-			</a>
-		</div>
-
-		<!-- Collect the nav links, forms, and other content for toggling -->
-		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
-			<ul class="nav navbar-nav">
-				<li class="active"><a href="http://jonnnnyw.github.io/php-phantomjs/">Home</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">Installation</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">Usage</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">Advanced</a></li>
-				<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html">Troubleshooting</a></li>
-			</ul>
-		</div><!-- /.navbar-collapse -->
-	</nav>
-
-	<!-- nav-menu-dropdown -->
-	<div class="btn-group hidden-xs" id="nav-menu">
-		<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
-			<i class="fa fa-bars"></i>
-		</button>
-		<ul class="dropdown-menu" role="menu">
-		    <li><a href="http://jonnnnyw.github.io/php-phantomjs/"><i class="fa fa-home"></i>Home</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/installation.html"><i class="fa fa-folder"></i>Installation</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/usage.html"><i class="fa fa-folder"></i>Usage</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html"><i class="fa fa-folder"></i>Advanced</a></li>
-			<li><a href="http://jonnnnyw.github.io/php-phantomjs/troubleshooting.html"><i class="fa fa-folder"></i>Troubleshooting</a></li>
-			<li class="divider"></li>
-			<li><a href="#"><i class="fa fa-arrow-up"></i>Top of Page</a></li>
-		</ul>
-	</div>
-
-	<div class="col-sm-3 sidebar hidden-xs">
-		<! -- sidebar.html -->
-<header class="sidebar-header" role="banner">
-	<a href="http://jonnnnyw.github.io/php-phantomjs/">
-		<img src="http://jonnnnyw.github.io/php-phantomjs/assets/media/phantomjs.png" class="img-circle" />
-	</a>
-	<h3 class="title">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/">PHP PhantomJs</a>
-    </h3>
-</header>
-
-
-<div id="bio" class="text-center">
-	Run PhantomJS scripts through PHP
-</div>
-
-
-<div id="contact-list" class="text-center">
-
-	<ul class="list-unstyled list-inline">
-		
-		<li>
-            <iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=watch&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-		
-		<li>
-			<iframe src="http://ghbtns.com/github-btn.html?user=jonnnnyw&repo=php-phantomjs&type=fork&count=true"
-                allowtransparency="true" frameborder="0" scrolling="0" width="83" height="20"></iframe>
-		</li>
-		
-	</ul>
-
-</div>
-<! -- sidebar.html end -->
-
-	</div>
-
-	<div class="col-sm-9 col-sm-offset-3">
-		
-
-
-<div class="page-header">
-  <h1>Introduction </h1>
-</div>
-
-<article class="home">
-
-  <div>
-    
-    <p>PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.</p>
-
-<h2 id="feature-list">Feature List</h2>
-
-<ul>
-  <li>Load webpages through the PhantomJS headless browser</li>
-  <li>View detailed response data including page content, headers, status<br />
-code etc.</li>
-  <li>Handle redirects</li>
-  <li>View javascript console errors</li>
-  <li>View detailed PhantomJS debuged information</li>
-  <li>Save screen captures to local disk</li>
-  <li>Set viewport size</li>
-  <li>Define screen capture x, y, width and height parameters</li>
-  <li>Delay page rendering for a specified time</li>
-  <li>Execute PhantomJS with command line options</li>
-  <li>Easily build and run custom PhantomJS scripts</li>
-</ul>
-
-<h2 id="prerequisites">Prerequisites</h2>
-
-<p>PHP PhantomJS requires PHP <strong>5.3.0</strong> or greater to run.</p>
-
-<h2 id="installation">Installation</h2>
-
-<p>It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s <code>composer.json</code> file:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-
-    <span class="s">&quot;scripts&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;post-install-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">],</span>
-        <span class="s">&quot;post-update-cmd&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">[</span>
-            <span class="s">&quot;PhantomInstaller\\Installer::installPhantomJS&quot;</span>
-        <span class="p-Indicator">]</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:</p>
-
-<div class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="c1">#composer.json</span>
-    
-    <span class="s">&quot;config&quot;</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
-        <span class="s">&quot;bin-dir&quot;</span><span class="p-Indicator">:</span> <span class="s">&quot;bin&quot;</span>
-    <span class="p-Indicator">}</span></code></pre></div>
-
-<p>Finally, install PHP PhantomJS from the root of your project:</p>
-
-<div class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c">#bash</span>
-    
-    <span class="nv">$ </span>composer require <span class="s2">&quot;jonnyw/php-phantomjs:3.*&quot;</span></code></pre></div>
-
-<p>If you would like to use another installation method or would like to see more detailed installation instructions, see the <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html">installation</a> documentation.</p>
-
-<h2 id="basic-usage">Basic Usage</h2>
-
-<p>The following illustrates how to make a basic GET request and output the page content:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Request </span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span>
-
-    <span class="k">if</span><span class="p">(</span><span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getStatus</span><span class="p">()</span> <span class="o">===</span> <span class="mi">200</span><span class="p">)</span> <span class="p">{</span>
-
-        <span class="c1">// Dump the requested page content</span>
-        <span class="k">echo</span> <span class="nv">$response</span><span class="o">-&gt;</span><span class="na">getContent</span><span class="p">();</span>
-    <span class="p">}</span></code></pre></div>
-
-<p>And if you would like to save a screen capture to local disk:</p>
-
-<div class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp">&lt;?php</span>
-
-    <span class="k">use</span> <span class="nx">JonnyW\PhantomJs\Client</span><span class="p">;</span>
-
-    <span class="nv">$client</span> <span class="o">=</span> <span class="nx">Client</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\CaptureRequest</span>
-<span class="sd">     **/</span>
-    <span class="nv">$request</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createCaptureRequest</span><span class="p">(</span><span class="s1">&#39;http://google.com&#39;</span><span class="p">,</span> <span class="s1">&#39;GET&#39;</span><span class="p">);</span>
-    <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">setCaptureFile</span><span class="p">(</span><span class="s1">&#39;/path/to/save/capture/file.jpg&#39;</span><span class="p">);</span>
-
-    <span class="sd">/** </span>
-<span class="sd">     * @see JonnyW\PhantomJs\Message\Response </span>
-<span class="sd">     **/</span>
-    <span class="nv">$response</span> <span class="o">=</span> <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">getMessageFactory</span><span class="p">()</span><span class="o">-&gt;</span><span class="na">createResponse</span><span class="p">();</span>
-
-    <span class="c1">// Send the request</span>
-    <span class="nv">$client</span><span class="o">-&gt;</span><span class="na">send</span><span class="p">(</span><span class="nv">$request</span><span class="p">,</span> <span class="nv">$response</span><span class="p">);</span></code></pre></div>
-
-<p>For more detailed examples see the <a href="http://jonnnnyw.github.io/php-phantomjs/usage.html">usage</a> section, or to create your own custom scripts check out the <a href="http://jonnnnyw.github.io/php-phantomjs/advanced.html">advanced</a> documentation.</p>
-
-
-    
-  </div>
-  
-  <div class="clearfix"></div>
-  <hr/>
-
-  <ul class="pager"> 
-      
-      <li class="next">
-        <a href="http://jonnnnyw.github.io/php-phantomjs/installation.html" title="Installation">Installation &rarr;</a>
-      </li>
-      
-  </ul>
-
-</article>
-
-
-
-
-
-
-		<footer>
-			<hr/>
-			<p>
-				&copy; 2014 PHP PhantomJs. Theme: Modified <a href="https://github.com/dbtek/dbyll">dbyll</a> by dbtek.
-			</p>
-		</footer>
-	</div>
-
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/jquery/jquery.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/resources/bootstrap/js/bootstrap.min.js"></script>
-	<script type="text/javascript" src="http://jonnnnyw.github.io/php-phantomjs/assets/js/app.js"></script>
-	
-</body>
-</html>
-

+ 2 - 0
_posts/2014-07-28-introduction.md → _version_3/1-introduction.md

@@ -4,6 +4,8 @@ title: Introduction
 categories: []
 tags: []
 fullview: true
+version: 3.0
+permalink: /3.0/
 ---
 
 PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures.

+ 1 - 0
_posts/2014-07-27-installation.md → _version_3/2-installation.md

@@ -4,6 +4,7 @@ title: Installation
 categories: []
 tags: []
 fullview: true
+version: 3.0
 ---
 
 * [Prerequisites](#prerequisites)

+ 1 - 0
_posts/2014-07-26-usage.md → _version_3/3-usage.md

@@ -4,6 +4,7 @@ title: Usage
 categories: []
 tags: []
 fullview: true
+version: 3.0
 ---
 
 This page contains some common examples of how to use the PHP PhantomJS library.

+ 3 - 2
_posts/2014-07-25-advanced.md → _version_3/4-advanced.md

@@ -4,10 +4,11 @@ title: Advanced Usage
 categories: []
 tags: []
 fullview: true
+version: 3.0
 ---
 
-* [PhantomJS command line options](#phantomjs-command-line-options)
-* [Custom PhantomJS scripts](#custom-phantomjs-scripts)
+  * [PhantomJS command line options](#phantomjs-command-line-options)
+  * [Custom PhantomJS scripts](#custom-phantomjs-scripts)
   * [Writing a custom script](#writing-a-custom-script)
   * [Using custom request parameters in your script](#using-custom-request-parameters-in-your-script)
   * [Loading your script](#loading-your-script)

+ 1 - 0
_posts/2014-07-23-troubleshooting.md → _version_3/5-troubleshooting.md

@@ -4,6 +4,7 @@ title: Troubleshooting
 categories: []
 tags: []
 fullview: true
+version: 3.0
 ---
 
 * [It's not installing anything to my bin directory](#its-not-installing-anything-to-my-bin-directory)

+ 179 - 0
_version_4/1-introduction.md

@@ -0,0 +1,179 @@
+---
+layout: post
+title: Introduction
+categories: []
+tags: []
+fullview: true
+version: 4.0
+permalink: /4.0/
+---
+
+PHP PhantomJS is a flexible PHP library to load pages through the PhantomJS headless browser and return the page response. It is handy for testing websites that demand javascript support and also supports screen captures and PDF output.
+
+Feature List
+------------
+
+*  Load webpages through the PhantomJS headless browser
+*  View detailed response data including page content, headers, status
+   code etc.
+*  Handle redirects
+*  View javascript console errors
+*  View detailed PhantomJS debuged information
+*  Save screen captures to local disk
+*  Output web pages to PDF document
+*  Set viewport size
+*  Define screen capture x, y, width and height parameters
+*  Delay page rendering for a specified time
+*  Execute PhantomJS with command line options
+*  Easily build and run custom PhantomJS scripts
+
+Prerequisites
+-------------
+
+PHP PhantomJS requires PHP **5.3.0** or greater to run.
+
+Installation
+------------
+
+It is recommended that you use Composer to install PHP PhantomJS. First, add the following to your project’s `composer.json` file:
+
+{% highlight yaml %}
+    
+    #composer.json
+
+    "scripts": {
+        "post-install-cmd": [
+            "PhantomInstaller\\Installer::installPhantomJS"
+        ],
+        "post-update-cmd": [
+            "PhantomInstaller\\Installer::installPhantomJS"
+        ]
+    }
+    
+{% endhighlight %}
+
+This will ensure the latest version of PhantomJS is installed for your system, in your bin folder. If you haven’t defined your bin folder in your composer.json, add the path:
+
+{% highlight yaml %}
+    
+    #composer.json
+    
+    "config": {
+        "bin-dir": "bin"
+    }
+{% endhighlight %}
+
+Finally, install PHP PhantomJS from the root of your project:
+
+{% highlight bash %}
+    
+    #bash
+    
+    $ composer require "jonnyw/php-phantomjs:4.*"
+{% endhighlight %}
+
+If you would like to use another installation method or would like to see more detailed installation instructions, see the [installation]({{ site.BASE_PATH }}/4.0/installation/) documentation.
+
+> #### Important
+> By default the PhantomJS library will look for the PhantomJS executable in the bin folder relative to where your script is running `~/bin/phantomjs`. If the executable cannot be found or if the path to your PhantomJS executable differs from the default location, for example you have installed PhantomJS globally, you will need to define the path to your PhantomJS executable manually.
+> 
+> `$client->getEngine()->setPath('/path/to/phantomjs');`
+
+Basic Usage
+-----------
+
+The following illustrates how to make a basic GET request and output the page content:
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+
+    $client = Client::getInstance();
+
+    /** 
+     * @see JonnyW\PhantomJs\Message\Request 
+     **/
+    $request = $client->getMessageFactory()->createRequest('http://jonnyw.me', 'GET');
+
+    /** 
+     * @see JonnyW\PhantomJs\Message\Response 
+     **/
+    $response = $client->getMessageFactory()->createResponse();
+
+    // Send the request
+    $client->send($request, $response);
+
+    if($response->getStatus() === 200) {
+
+        // Dump the requested page content
+        echo $response->getContent();
+    }
+    
+{% endhighlight %}
+
+Saving a screen capture to local disk:
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+
+    $client = Client::getInstance();
+    
+    $width  = 800;
+    $height = 600;
+    $top    = 0;
+    $left   = 0;
+    
+    /** 
+     * @see JonnyW\PhantomJs\Message\CaptureRequest
+     **/
+    $request = $client->getMessageFactory()->createCaptureRequest('http://jonnyw.me', 'GET');
+    $request->setOutputFile('/path/to/save/capture/file.jpg');
+    $request->setViewportSize($width, $height);
+    $request->setCaptureDimensions($width, $height, $top, $left);
+
+    /** 
+     * @see JonnyW\PhantomJs\Message\Response 
+     **/
+    $response = $client->getMessageFactory()->createResponse();
+
+    // Send the request
+    $client->send($request, $response);
+    
+{% endhighlight %}
+
+Outputting a page as PDF:
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+
+    $client = Client::getInstance();
+
+    /** 
+     * @see JonnyW\PhantomJs\Message\PdfRequest
+     **/
+    $request = $client->getMessageFactory()->createPdfRequest('http://jonnyw.me', 'GET');
+    $request->setOutputFile('/path/to/save/pdf/document.pdf');
+    $request->setFormat('A4');
+    $request->setOrientation('landscape');
+    $request->setMargin('1cm');
+
+    /** 
+     * @see JonnyW\PhantomJs\Message\Response 
+     **/
+    $response = $client->getMessageFactory()->createResponse();
+
+    // Send the request
+    $client->send($request, $response);
+    
+{% endhighlight %}
+
+For more detailed examples see the [usage]({{ site.BASE_PATH }}/4.0/usage/) section, or you can [create your own custom scripts]({{ site.BASE_PATH }}/4.0/custom-scripts/).
+

+ 125 - 0
_version_4/2-installation.md

@@ -0,0 +1,125 @@
+---
+layout: post
+title: Installation
+categories: []
+tags: []
+fullview: true
+version: 4.0
+---
+
+* [Prerequisites](#prerequisites)
+* [Installing via Composer](#installing-via-composer)
+* [Custom Installation](#custom-installation)
+* [Installing from tarball](#installing-from-tarball)
+
+---
+
+Prerequisites
+-------------
+
+PHP PhantomJS requires PHP **5.3.0** or greater to run.
+
+Installing via Composer
+-----------------------
+
+Install [Composer](https://getcomposer.org/) for your project:
+
+{% highlight bash %}
+
+    #bash
+
+    $ curl -s http://getcomposer.org/installer | php
+{% endhighlight %}
+
+Create a `composer.json` file in the root of your project:
+
+{% highlight yaml %}
+
+    #composer.json
+
+    {
+        "require": {
+            "jonnyw/php-phantomjs": "4.*"
+        },
+        "config": {
+            "bin-dir": "bin"
+        },
+        "scripts": {
+            "post-install-cmd": [
+                "PhantomInstaller\\Installer::installPhantomJS"
+            ],
+            "post-update-cmd": [
+                "PhantomInstaller\\Installer::installPhantomJS"
+            ]
+        }
+    }
+{% endhighlight %}
+
+It is important that you have the 'scripts' section shown above in your `composer.json` file as it will install the latest version of PhantomJS for your system to your project's bin folder. It is recommended that you create a bin folder in the root of your project as this is where the PHP PhantomJS library will look for your PhantomJS executable. If you would prefer to use a PhantomJS executable in a custom location, see the [Custom Installation](#custom-installation) section.
+
+Finally, install the composer depedencies for your project:
+
+{% highlight bash %}
+    
+    #bash
+    
+    $ php composer.phar install
+{% endhighlight %}
+
+Custom Installation
+-------------------
+
+If you would prefer to use a custom install location for the PhantomJS executable, for example you have PhantomJS installed globally, then you simply need to set the path to PhantomJS manually:
+
+{% highlight php %}
+    
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+
+    $client = Client::getInstance();
+    $client->getEngine()->setPath('/path/to/phantomjs');
+{% endhighlight %}
+
+If you would like composer to install the PhantomJS executable to a custom bin location when installing dependencies, set the bin dir location in your project's `composer.json` file:
+
+{% highlight yaml %}
+
+    #composer.json
+
+    {
+        "config": {
+            "bin-dir": "/path/to/your/projects/bin/dir"
+        }
+    }
+{% endhighlight %}
+
+You will need to make sure that this directory exists and is writable by Composer before running the composer install.
+
+Once you have updated your bin location run composer install to install PhantomJS:
+
+{% highlight bash %}
+    
+    #bash
+    
+    $ php composer.phar install
+{% endhighlight %}
+
+This should install the correct PhantomJS executable for your system in the bin locaiton you defined in your `composer.json` file. 
+
+
+Installing from tarball
+-----------------------
+
+The PHP PhantomJS library contains several depedencies in order to function so it is recommended that you install it via composer as this will handle your dependencies for you. If you do wish to install it from a [tarball release](https://github.com/jonnnnyw/php-phantomjs/tags) then you will need to install the dependencies manually.
+
+The PHP PhantomJS library currently requires the following depdencies:
+
+-  [Symfony Config Component](https://github.com/symfony/Config) ~2.5
+-  [Symfony YAML Component](https://github.com/symfony/Yaml) ~2.5
+-  [Symfony Dependency Injection Component](https://github.com/symfony/DependencyInjection) ~2.5
+-  [Symfony Filesystem Component](https://github.com/symfony/filesystem) ~2.5
+-  [Twig templating Component](https://github.com/fabpot/Twig) ~1.16
+-  [PhantomJS](http://phantomjs.org/) ~1.9
+
+Make sure the components are in your include path and that the PhantomJS executable is installed to your projects bin folder as mentioned in the [Custom Installation](#custom-installation) section.

+ 409 - 0
_version_4/3-usage.md

@@ -0,0 +1,409 @@
+---
+layout: post
+title: Usage
+categories: []
+tags: []
+fullview: true
+version: 4.0
+---
+
+This page contains some common examples of how to use the PHP PhantomJS library.
+
+* [Setup](#setup)
+* [Basic Request](#basic-request)
+* [POST Request](#post-request)
+* [Other Request Methods](#other-request-methods)
+* [Response Data](#response-data)
+* [Screen Captures](#screen-captures)
+* [Output To PDF](#output-to-pdf)
+* [Set Viewport Size](#set-viewport-size)
+* [Custom Timeout](#custom-timeout)
+* [Delay Page Render](#delay-page-render)
+* [PhantomJS Options](#phantomjs-options)
+* [Exceptions](#exceptions)
+
+For more advanced customization or to load your own PhantomJS scripts, see the [custom scripts]({{ site.BASE_PATH }}/4.0/custom-scripts/) section.
+
+---
+
+Setup
+-----
+
+By default the PhantomJS library will look for the PhantomJS executable in the bin folder relative to where your script is running `~/bin/phantomjs`. If the executable cannot be found or if the path to your PhantomJS executable differs from the default location, for example you have installed PhantomJS globally, you will need to define the path to your PhantomJS executable manually.
+
+{% highlight php %}
+    
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    $client->getEngine()->setPath('/path/to/phantomjs');
+    
+{% endhighlight %}
+
+> #### Note
+> The path must include the name of the PhantomJS executable in it, not just a path to the directory containing the executable.
+
+Basic Request
+-------------
+
+A basic GET request:
+
+{% highlight php %}
+    
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    
+    $request  = $client->getMessageFactory()->createRequest();
+    $response = $client->getMessageFactory()->createResponse();
+    
+    $request->setMethod('GET');
+    $request->setUrl('http://jonnyw.me');
+    
+    $client->send($request, $response);
+    
+    if($response->getStatus() === 200) {
+        echo $response->getContent();
+    }
+{% endhighlight %}
+
+You can also set the URL, request method and timeout period when creating a new request instance through the message factory:
+
+{% highlight php %}
+
+    <?php
+     
+    ...
+    
+    $request = $client->getMessageFactory()->createRequest('http://jonnyw.me', 'GET', 5000);
+    
+    ...
+    
+{% endhighlight %}
+
+POST Request
+------------
+
+A basic POST request:
+
+{% highlight php %}
+
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    
+    $request  = $client->getMessageFactory()->createRequest();
+    $response = $client->getMessageFactory()->createResponse();
+    
+    $data = array(
+        'param1' => 'Param 1',
+        'param2' => 'Param 2'
+    );
+    
+    $request->setMethod('POST');
+    $request->setUrl('http://jonnyw.me');
+    $request->setRequestData($data); // Set post data
+    
+    $client->send($request, $response);
+{% endhighlight %}
+
+Other Request Methods
+---------------------
+
+The PHP PhantomJS library supports the following request methods:
+
+* OPTIONS
+* GET
+* HEAD
+* POST
+* PUT
+* DELETE
+* PATCH
+
+The request method can be set when creating a new request instance through the message factory:
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    
+    $request = $client->getMessageFactory()->createRequest('http://jonnyw.me', 'PUT');
+{% endhighlight %}
+
+Or on the request instance itself:
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $request = $client->getMessageFactory()->createRequest();
+    $request->setMethod('PATCH');
+    
+    ...
+    
+{% endhighlight %}
+
+Response Data
+-------------
+
+A standard response object gives you access to the following interface:
+
+| Accessor            | Description                                                                               |  Return Type   |
+| :-----------------: | ----------------------------------------------------------------------------------------- | :------------: |
+| getHeaders()        | Returns an array of all response headers.                                                 | Array          |
+| getHeader(*header*) | Returns the value for a specific response header e.g. Content-Type.                       | Mixed          |
+| getStatus()         | The response status code e.g. 200.                                                        | Integer        |
+| getContent()        | The raw page content of the requested page.                                               | String         |
+| getContentType()    | The content type of the requested page.                                                   | String         |
+| getUrl()            | The URL of the requested page.                                                            | String         |
+| getRedirectUrl()    | If the response was a redirect, this will return the redirect URL.                        | String         |
+| isRedirect()        | Will return true if the response was a redirect or false otherwise.                       | Boolean        |
+| getConsole()        | Returns an array of any javascript errors on the requested page along with a stack trace. | Array          |
+
+> #### Note
+> If the response ever contains a status code of 0, chances are the request failed. Check the request [debug log]({{ site.BASE_PATH }}/4.0/troubleshooting/#how-do-i-debug-a-request) for more detailed information about what may have gone wrong.
+
+Screen Captures
+---------------
+
+You can save screen captures of a page to your local disk by creating a screen capture request and setting the path you wish to save the file to:
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    
+    $request  = $client->getMessageFactory()->createCaptureRequest('http://jonnyw.me');
+    $response = $client->getMessageFactory()->createResponse();
+    
+    $file = '/path/to/save/your/screen/capture/file.jpg';
+    
+    $request->setOutputFile($file);
+    
+    $client->send($request, $response);
+{% endhighlight %}
+
+You will need to make sure the directory that you are saving the file to exists and is writable by your application.
+
+You can also set the width, height, x and y axis for your screen capture:
+
+{% highlight php %}
+
+    <?php
+    
+    ...
+    
+    $top    = 10;
+    $left   = 10;
+    $width  = 200;
+    $height = 400;
+    
+    $request->setCaptureDimensions($width, $height, $top, $left);
+    
+    ...
+    
+{% endhighlight %}
+
+Output To PDF
+-------------
+
+You can output a page to PDF by creating a PDF request and setting the path you wish to save the document to.
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    
+    $request  = $client->getMessageFactory()->createPdfRequest('http://jonnyw.me');
+    $response = $client->getMessageFactory()->createResponse();
+    
+    $file = '/path/to/save/your/pdf/document.pdf';
+    
+    $request->setOutputFile($file);
+    
+    $client->send($request, $response);
+{% endhighlight %}
+
+You can set the paper size and margin of the PDF.
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $width  = '10cm';
+    $height = '20cm';
+    $margin = '2cm';
+    
+    $request->setPaperSize($width, $height);
+    $request->setMargin($margin);
+    
+    ...
+    
+{% endhighlight %}
+
+If you prefer, you can set a standard paper format such as A4 instead of paper size.
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $format = 'A4';
+    
+    $request->setFormat($format);
+    
+    ...
+    
+{% endhighlight %}
+
+Along with the paper orientation.
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $orientation = 'landscape';
+    
+    $request->setOrientation($orientation);
+    
+    ...
+    
+{% endhighlight %}
+
+Set Viewport Size
+-----------------
+
+You can easily set the viewport size for a request:
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $width  = 200;
+    $height = 400;
+    
+    $request  = $client->getMessageFactory()->createRequest('http://jonnyw.me');
+    $request->setViewportSize($width, $height);
+    
+    ...
+    
+{% endhighlight %}
+
+Custom Timeout
+--------------
+
+By default, each request will timeout after 5 seconds. You can set a custom timeout period (in milliseconds) for each request:
+
+{% highlight php %}
+
+    <?php
+    
+    ...
+    
+    $timeout = 10000; // 10 seconds
+    
+    $request = $client->getMessageFactory()->createRequest('http://jonnyw.me');
+    $request->setTimeout($timeout);
+    
+    ...
+    
+{% endhighlight %}
+
+Delay Page Render
+-----------------
+
+Sometimes when saving a page to local disk you may want to wait until the page is completely loaded first. In this instance you can set a page render delay (in seconds) for the request:
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $delay = 5; // 5 seconds
+    
+    $request = $client->getMessageFactory()->createCaptureRequest('http://jonnyw.me');
+    $request->setDelay($delay);
+    
+    ...
+    
+{% endhighlight %}
+
+
+PhantomJS Options
+-----------------
+
+The PhantomJS API contains a range of command line options that can be passed when executing the PhantomJS executable. These can also be passed in via the client before a request:
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    $client->getEngine()->addOption('--load-images=true');
+    $client->getEngine()->addOption('--ignore-ssl-errors=true');
+    
+    $request  = $client->getMessageFactory()->createRequest('http://jonnyw.me');
+    $response = $client->getMessageFactory()->createResponse();
+
+    $client->send($request, $response);
+{% endhighlight %}
+
+You can also set a path to a JSON configuration file that contains multiple PhantomJS options:
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $client = Client::getInstance();
+    $client->getEngine()->addOption('--config=/path/to/config.json');
+    
+    ...
+
+{% endhighlight %}
+
+See the [PhantomJS Documentation](http://phantomjs.org/api/command-line.html) for a full list of command line options.
+
+Exceptions
+----------
+
+The following offers an explanation of the exceptions that may be raised by the PhantomJS library.
+
+| Exception                  | Description                                                                                      |
+| -------------------------- | ------------------------------------------------------------------------------------------------ |
+| InvalidExecutableException | The path to the PhantomJS executable is invalid or is not executable.                            |
+| InvalidMethodException     | The request method is invalid. It must be one of OPTIONS, GET, HEAD, POST, PUT, DELETE or PATCH. |
+| InvalidUrlException        | The URL you are requesting is an invalid format.                                                 |
+| NotExistsException         | A file could not be found or does not exist.                                                     |
+| NotWritableException       | A file could not be written.                                                                     |
+| ProcedureFailedException   | A PhantomJS script failed to execute successfully.                                               |
+| RequirementException       | A PhantomJS script is missing a required element e.g. `phantom.exit(1);`.                        |
+| SyntaxException            | A PhantomJS script contains a javascript syntax error.                                           |

+ 416 - 0
_version_4/4-custom-scripts.md

@@ -0,0 +1,416 @@
+---
+layout: post
+title: Custom Scripts
+categories: []
+tags: []
+fullview: true
+version: 4.0
+---
+
+  * [Custom PhantomJS scripts](#custom-phantomjs-scripts)
+  * [Partial script injection](#partial-script-injection)
+  * [Writing a custom template](#writing-a-custom-template)
+  * [Using custom request parameters in your script](#using-custom-request-parameters-in-your-script)
+
+---
+
+Custom PhantomJS scripts
+------------------------
+
+In most cases you shouldn't need to worry about the javascript files that run the PHP PhantomJS library but there may be times when you want to execute your own custom PhantomJS scripts through the client. This can be easily achieved in 2 ways - either through [partial script injection](#partial-script-injection) or by [writing your own custom template](#writing-a-custom-template).
+
+When PhantomJS performs a request it loads a script template file and builds a PhantomJS script by injecting small blocks of javascript code into the template. These partial code blocks inject functionality such as setting the viewport size, capture options, error handling etc. These code blocks may be overridden allowing you to manipulate the way requests are performed, with little effort.
+
+Alternatively you can write your own script template changing how PHP PhantomJS executes scripts altogether. This requires more work but can be very powerful.
+
+> #### Note
+>  PHP PhantomJS compiles, validates and caches scripts when they are first run to greatly improve performance. If you would like to clear this cache or disable it while you are writing your own scripts then refer to the [caching section]({{ site.BASE_PATH }}/4.0/caching/).
+
+Partial script injection
+------------------------
+
+Partial script injection is the easiest way to manipulate the scripts that are executed by PhantomJS. When PHP PhantomJS performs a request it loads a script template and compiles small blocks of javascript into the template before executing the script. These injected blocks contain different pieces of PhantomJS functionality such as setting the viewport size, capture options, logging and error handling etc. You can override as many of these blocks as you please to change they way a script functions.
+
+The following outlines the partial blocks that are compiled into a PHP PhantomJS template by default.
+
+| Block Name                                   | Description                                                                                      |
+| -------------------------------------------- | ------------------------------------------------------------------------------------------------ |
+| [global_variables.partial](http://)          | Allows any javascript variables to be injected at the top of the script.                         |
+| [page_clip_rect.partial](http://)            | If the request is a screen capture, this will define the page clipping rectangle.                |
+| [page_custom_headers.partial](http://)       | Set any custom headers on the page object.                                                       |
+| [page_on_error.partial](http://)             | Defines the code that is executed on page error.                                                 |
+| [page_on_resource_received.partial](http://) | Defines the code that is executed on resource receive.                                           |
+| [page_on_resource_timeout.partial](http://)  | Defines the code that is executed on resource timeout.                                           |
+| [page_open.partial](http://)                 | Defines the code that is executed on page open.                                                  |
+| [page_paper_size.partial](http://)           | If the request is PDF output, this will set up the paper size.                                   |
+| [page_settings.partial](http://)             | Defines any page settings most notably the resource timeout value.                               |
+| [page_viewport_size.partial](http://)        | Set up the viewport size if defined in the request.                                              |
+| [phantom_on_error.partial](http://)          | Defines the code that is execute on PhantomJS error.                                             |
+| [procedure_capture.partial](http://)         | Defines the code that is executed if the request is a capture request.                           |
+| [procedure_default.partial](http://)         | Defines the code that is executed for a default request.                                         |
+| [procedure_pdf.partial](http://)             | Defines the code that is executed if the request is a PDF request.                               |
+
+
+> #### Note
+>  It may pay to check out the [default script template](http://) to see where each of these blocks are rendered when compiling the PhantomJS script.
+
+To override a partial block with your own code first you need to create a file with the same name as the block that you are overriding. Make sure that this file can be read by your application.
+
+{% highlight bash %}
+    
+    #bash
+    
+    $ touch phantom_on_error.partial
+    $ chmod 755 phantom_on_error.partial
+    
+{% endhighlight %}
+
+Next open your partial block in your text editor and write the code you wish to execute. The [PhantomJS documentation](http://phantomjs.org/quick-start.html) has more detailed information on writing custom scripts.
+
+{% highlight javascript %}
+    
+    {% raw %}
+    
+    // phantom_on_error.partial
+    
+    var error = {
+      msg: 'There was an error!'  
+    };
+    
+    system.stdout.write(JSON.stringify(error));
+    phantom.exit(1);
+
+    ...
+    
+    {% endraw %}
+    
+{% endhighlight %}
+
+
+Now you need to tell PHP PhantomJS where to look for your partial block. This is achieved by creating a procedure loader that points at your custom script directory. The service container has a factory that makes creating a new procedure loader easy.
+
+{% highlight php %}
+
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    use JonnyW\PhantomJs\DependencyInjection\ServiceContainer;
+    
+    $location = '/path/to/your/script/directory';
+    
+    $serviceContainer = ServiceContainer::getInstance();
+    
+    $procedureLoader = $serviceContainer->get('procedure_loader_factory')
+        ->createProcedureLoader($location);
+        
+    ...
+{% endhighlight %}
+
+
+Finally add your procedure loader to the load loop. By default the client contains a chain procedure loader which lets you maintain multiple procedure loaders. Ultimately this means that you can load your custom script blocks while still maintaining the ability to load the default ones.
+
+So now just add the procedure loader that you created above to the chain loader.
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $client = Client::getInstance();
+    $client->getProcedureLoader()->addLoader($procedureLoader);
+    
+    ...
+{% endhighlight %}
+
+> #### Note
+> If multiple procedure loaders are defined, PHP PhantomJS will alwasy look for custom scripts first before falling back on the default ones.
+
+Now whenever you perform a request PHP PhantomJS will look in your script directory first for any partial blocks to inject. You can override as many script blocks as you wish but be aware that in doing so you may limit or break the functionality of the PHP PhantomJS library.
+
+Below is a full example for clarity.
+
+{% highlight php %}
+
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    use JonnyW\PhantomJs\DependencyInjection\ServiceContainer;
+    
+    $location = '/path/to/your/script/directory';
+    
+    $serviceContainer = ServiceContainer::getInstance();
+    
+    $procedureLoader = $serviceContainer->get('procedure_loader_factory')
+        ->createProcedureLoader($location);
+        
+    $client = Client::getInstance();
+    $client->getProcedureLoader()->addLoader($procedureLoader);
+    
+    $request  = $client->getMessageFactory()->createRequest();
+    $response = $client->getMessageFactory()->createResponse();
+    
+    $client->send($request, $response);
+
+{% endhighlight %}
+
+> #### Note
+> PHP PhantomJS compiles and caches scripts when they are first run to greatly improve performance. This cache can be easily [cleared]({{ site.BASE_PATH }}/4.0/caching/#clearing-the-cache) or [disabled]({{ site.BASE_PATH }}/4.0/caching/#disabling-the-cache) while you are developing your own custom scripts. Do be aware that script execution time will be greatly increased by disabling the cache.
+
+> #### Note
+> Scripts are validated using a Javascript validation engine when they are compiled. For help debugging validation errors see the [debugging]({{ site.BASE_PATH }}/4.0/debugging/#validation-errors) section.
+
+
+Writing a custom template
+-------------------------
+
+The script template that is run by PHP PhantomJS on each request can be easily replaced with your own version. This requires more work to get right but can be very powerful.
+
+The first step in creating your script is to create a procedure file somewhere. For the purpose of this guide we will refer to it as `my_procedure.proc` but in reality it can be called anything you like. The only requirement is that the file extension must be `.proc`.
+
+Create the file somewhere and make sure it can be read by your application.
+
+{% highlight bash %}
+    
+    #bash
+    
+    $ touch my_procedure.proc
+    $ chmod 755 my_procedure.proc
+    
+{% endhighlight %}
+
+Next open your procedure file in a text editor and write your PhantomJS script. The [PhantomJS documentation](http://phantomjs.org/quick-start.html) has more detailed information on writing scripts for PhantomJS.
+
+{% highlight javascript %}
+    
+    {% raw %}
+    
+    // my_procedure.proc
+
+    var page  = require('webpage').create();
+    
+    page.open ('{{ input.getUrl() }}', '{{ input.getMethod() }}', '{{ input.getBody() }}', function (status) {
+         
+        // It is important that you exit PhantomJS
+        // when your script has run or when you
+        // encounter an error
+        phantom.exit(1);
+    });
+    
+    ...
+    
+    {% endraw %}
+    
+{% endhighlight %}
+
+> #### Important
+> Make sure that `phantom.exit(1);` is always called after your script has run or if you encounter an error. This requires you to take care when handling PhantomJS errors to ensure that you exit the PhantomJS script, whether the script was successfully executed or not. If you do not call `phantom.exit(1);` then PhantomJS will continue to run until your PHP script times out. You will most likely receive a validation error if you omit this from your script anyway.
+
+It is a good practice to create a global error handler in your script that exits PhantomJS.
+
+{% highlight javascript %}
+    
+    {% raw %}
+    
+    // my_procedure.proc
+
+    phantom.onError = function(msg, trace) {
+  
+        phantom.exit(1);
+    };
+    
+    ...
+    
+    {% endraw %}
+    
+{% endhighlight %}
+
+As with the overriding of partial blocks mentioned earlier in this section, you need to tell PHP PhantomJS where to look for script template. This is achieved by creating a procedure loader that points at your custom script directory. The service container has a factory that makes creating a new procedure loader easy.
+
+{% highlight php %}
+
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    use JonnyW\PhantomJs\DependencyInjection\ServiceContainer;
+    
+    $location = '/path/to/your/script/directory';
+    
+    $serviceContainer = ServiceContainer::getInstance();
+    
+    $procedureLoader = $serviceContainer->get('procedure_loader_factory')
+        ->createProcedureLoader($location);
+        
+    ...
+{% endhighlight %}
+
+
+Now add your procedure loader to the load loop. By default the client contains a chain procedure loader which lets you maintain multiple procedure loaders. Ultimately this means that you can load your custom templates while still maintaining the ability to load the default ones.
+
+So now just add the procedure loader that you created above to the chain loader.
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $client = Client::getInstance();
+    $client->getProcedureLoader()->addLoader($procedureLoader);
+    
+    ...
+{% endhighlight %}
+
+Finally you need to tell the client which procedure template to load when making a request. The template name is the name of your procedure template file minus the `.proc` part.
+
+{% highlight php %}
+
+    <?php
+
+    ...
+    
+    $client = Client::getInstance();
+    $client->setProcedure('my_procedure');
+    
+    ...
+{% endhighlight %}
+
+Below is a full example for clarity.
+
+{% highlight php %}
+
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    use JonnyW\PhantomJs\DependencyInjection\ServiceContainer;
+    
+    $location = '/path/to/your/script/directory';
+    
+    $serviceContainer = ServiceContainer::getInstance();
+    
+    $procedureLoader = $serviceContainer->get('procedure_loader_factory')
+        ->createProcedureLoader($location);
+        
+    $client = Client::getInstance();
+    $client->setProcedure('my_procedure');
+    $client->getProcedureLoader()->addLoader($procedureLoader);
+    
+    $request  = $client->getMessageFactory()->createRequest();
+    $response = $client->getMessageFactory()->createResponse();
+    
+    $client->send($request, $response);
+
+{% endhighlight %}
+
+> #### Note
+> You may choose to support [partial script blocks](#partial-script-injection) in your template. It is worth checking out the [default script template](http://) to get an idea on how this is achieved.
+
+Using custom request parameters in your script
+----------------------------------------------
+
+Before a procedure is executed by the application it is parsed through a template parser. The PHP PhantomJS library uses the popular [Twig templating engine](https://github.com/fabpot/Twig). This gives you access to all the [Twig niceness](http://twig.sensiolabs.org/doc/templates.html) which you can use in your custom scripts.
+
+You may have noticed in the [writing a custom template](#writing-a-custom-template) section that we have used some Twig template tags referencing an input object e.g. {% raw %}`{{ input.getUrl() }}`{% endraw %}. This is in fact the PHP request instance that you created and passed to the client when sending your request, which is injected into the Twig template parser. As a result you gain full access to all the data contained within the request instance, via the data accessor methods.
+
+A default request instance contains the following accessors.
+
+{% raw %}
+
+| Accessor             | Description                                 |  Twig example                   |
+| -------------------- | ------------------------------------------- | ------------------------------- |
+| getMethod()          | The request method e.g. GET.                | {{ input.getMethod() }}         |
+| getTimeout()         | The request timeout period in milliseconds. | {{ input.getTimeout() }}        |
+| getDelay()           | The page render delay in seconds.           | {{ input.getDelay() }}          |
+| getViewportWidth()   | The viewport width.                         | {{ input.getViewportWidth() }}  |
+| getViewportHeight()  | The viewport height.                        | {{ input.getViewportHeight() }} |
+| getUrl()             | The request URL.                            | {{ input.getUrl() }}            |
+| getBody()            | The request body (POST, PUT).               | {{ input.getBody() }}           |
+| getHeaders(*format*) | The request headers.                        | {{ input.getHeaders('json') }}  |
+
+{% endraw %}
+
+A capture request contains a few additional ones.
+
+{% raw %}
+
+| Accessor         | Description                             |  Twig example                |
+| ---------------- | ----------------------------------------| ---------------------------- |
+| getRectTop()     | The x coordinate of the capture region. | {{ input.getRectTop() }}     |
+| getRectLeft()    | The y coordinate of the capture region. | {{ input.getRectLeft() }}    |
+| getRectWidth()   | The width of the capture region.        | {{ input.getRectWidth() }}   |
+| getRectHeight()  | The height of the capture region.       | {{ input.getRectHeight() }}  |
+| getCaptureFile() | The file to save the capture to.        | {{ input.getCaptureFile() }} |
+
+{% endraw %}
+
+And a PDF request a few more.
+
+{% raw %}
+
+| Accessor         | Description                              |  Twig example                |
+| ---------------- | -----------------------------------------| ---------------------------- |
+| getPaperWidth()  | The width to save the PDF e.g. '20cm'.   | {{ input.getPaperWidth() }}  |
+| getPaperHeight() | The height to save the PDF e.g. '20cm'.  | {{ input.getPaperHeight() }} |
+| getFormat()      | The paper format e.g. 'A4'.              | {{ input.getFormat() }}      |
+| getOrientation() | The orientation - portrait or landscape. | {{ input.getOrientation() }} |
+| getMargin()      | The paper margin e.g. '1cm'.             | {{ input.getMargin() }}      |
+
+{% endraw %}
+
+If you would like to inject additional data into your script through custom accessors, simply extend the request class with your own.
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Message\Request;
+    
+    class CustomRequest extends Request
+    {
+    
+        public function getSomething()
+        {
+            return 'Something!';
+        }
+    }
+{% endhighlight %}
+
+Now you will be able to access the data in your custom script when using your custom request.
+
+{% highlight javascript %}
+    
+    {% raw %}
+    
+    // my_procedure.proc
+
+    var something = '{{ input.getSomething() }}'; // Get something
+    
+    ...
+    
+    {% endraw %}
+    
+{% endhighlight %}
+
+And to use your custom request simply create a new instance of it and pass it to the client.
+
+{% highlight php %}
+
+    <?php
+
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    
+    $response = $client->getMessageFactory()->createResponse();
+    
+    $request  = new CustomRequest();
+    $request->setMethod('GET');
+    $request->setUrl('http://www.google.com');
+    
+    $client->send($request, $response);
+{% endhighlight %}
+
+> #### Troubleshooting
+> If you find that your script isn't running or that you are receiving a status of '0' back in the response, chances are you have a syntax error in you script. It pays to turn debugging on in the client `$client->debug(true)` which will then give you access to some log information through `$client->getLog()`.
+
+See more detailed information about [troubleshooting]({{ site.BASE_PATH }}/4.0/troubleshooting/).

+ 72 - 0
_version_4/5-caching.md

@@ -0,0 +1,72 @@
+---
+layout: post
+title: Caching
+categories: []
+tags: []
+fullview: true
+version: 4.0
+---
+
+* [Script caching](#script-caching)
+* [Clearing the cache](#clearing-the-cache)
+* [Disabling the cache](#disabling-the-cache)
+
+---
+
+Script caching
+--------------
+
+By default the PHP PhantomJs library compiles and aggressively caches script templates the first time that they are run. This means that if you override any [partial scripts]({{ site.BASE_PATH }}/4.0/custom-scripts/) after the script template has been cached by the library then the changes will not take affect until you [clear the compiled cache](#clearing-the-cache).
+
+It is recommended that you [disable the compiler cache](#disabling-the-cache) while developing your own custom scripts.
+
+> #### Note
+> The default cache location is the system tmp directory. The location of this directory can be found through the `sys_get_temp_dir()` PHP directive.
+
+Disabling the cache
+-------------------
+
+The compiler cache can be easily disabled. When disabled script templates will be compiled for each request and no caching will take place.
+
+{% highlight php %}
+    
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    $client->getProcedureCompiler()->disableCache();
+
+{% endhighlight %}
+
+The compiler cache is enabled by default however you can enable it manually if the situation arises.
+
+{% highlight php %}
+    
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    $client->getProcedureCompiler()->enableCache();
+
+{% endhighlight %}
+
+> #### Important
+> Script caching greatly improves performance therefore you should ensure that the cache is enabled in any production environment or in situtations where performance is important.
+
+Clearing the cache
+------------------
+
+The compiler cache can be easily cleared. This will force script templates to be recompiled and cached on the next request.
+
+{% highlight php %}
+    
+    <?php
+    
+    use JonnyW\PhantomJs\Client;
+    
+    $client = Client::getInstance();
+    $client->getProcedureCompiler()->clearCache();
+
+{% endhighlight %}

+ 86 - 0
_version_4/6-debugging.md

@@ -0,0 +1,86 @@
+---
+layout: post
+title: Debugging
+categories: []
+tags: []
+fullview: true
+version: 4.0
+---
+
+* [PhantomJS log](#phantomjs-log)
+* [Javascript console log](#javascript-console-log)
+* [Validation errors](#validation-errors)
+
+---
+
+PhantomJS log
+-------------
+
+Verbose logging can be enabled for PhantomJS by setting the debug flag on the client. This is the same as setting the PhantomJS `--debug=true` command line option.
+
+{% highlight php %}
+        
+    <?php 
+    
+    use JonnyW\PhantomJs\Client;
+
+    $client = Client::getInstance();
+    $client->debug(true);
+{% endhighlight %}
+
+The client log can be inspected after making a request.
+
+{% highlight php %}
+        
+    <?php 
+    
+    ...
+    
+    $client->getLog(); // String
+    
+    ...
+{% endhighlight %}
+
+> #### Note
+> The client log contains some helpful information specific to the PhantomJS library. In some cases these are present in the log even if debugging is disabled.
+
+Javascript console log
+----------------------
+
+The response object also provides access to a console log. Any javascript errors raised on the requested page will be present in the response console log.
+
+{% highlight php %}
+        
+    <?php 
+    
+    ...
+    
+    $response->getConsole(); // Array
+    
+    ...
+{% endhighlight %}
+
+Validation errors
+-----------------
+
+Before a script template is compiled and cached it is validated using the [Esprima](http://) javascript validation engine. If the script fails to validate then a `JonnyW\PhantomJs\Exception\SyntaxException` will be raised. Debug information about any validation errors can be found by calling a `getErrors()` helper method on the exception instance. This will return an array of error information. 
+
+{% highlight php %}
+
+    <?php 
+    
+    // $exception->getErrors();    
+    array(1) {
+      array(5) {
+        'lineNumber'  => 1,
+        'column'      => 17,
+        'index'       => 16,
+        'description' => 'Unexpected token ;',
+        'message'     => 'Line 1: Unexpected token ;'
+      }
+    }
+
+{% endhighlight %}
+
+> #### Important
+> Due to a limitation in the validation logic, scripts are currently minified to a single line before validating. This makes the `lineNumber` value contained in the error output redundant. This is due to be fixed in a future release.

+ 11 - 0
_version_4/7-troubleshooting.md

@@ -0,0 +1,11 @@
+---
+layout: post
+title: Troubleshooting
+categories: []
+tags: []
+fullview: true
+version: 4.0
+---
+
+> #### @todo
+> Troubleshooting guide coming soon.

+ 67 - 4
assets/css/style.css

@@ -83,9 +83,9 @@ article .share .gplus:hover {
 }
 
 .page-header {
+    margin-top: 50px;
     padding: 0 5% 0;
-	color: #e74c3c;
-	text-shadow: 1px 1px 1px rgba(150, 150, 150, 1);
+	color: #2c3e50;
 }
 
 article{
@@ -127,6 +127,24 @@ article.home h4 a:hover {
 	color: #e74c3c;
 }
 
+h2 {
+    margin-top: 40px;
+}
+
+blockquote {
+    margin-top: 30px;
+    background-color: #dbfcff;
+    border-left: 5px solid #30cad4;
+}
+
+code, .highlight .na, .highlight .nv {
+    color: #0fb4c0;
+}
+
+.highlight .sd {
+    color: #999988;
+}
+
 .author .author-image {
   float: left;
   margin-right: 20px;
@@ -134,7 +152,13 @@ article.home h4 a:hover {
 
 footer {
 	padding-top: 15px;
-	font-family: 'Ubuntu';
+    text-align: center;
+}
+
+.panel {
+    margin: 0;
+    border: none;
+    background-color: transparent;
 }
 
 /* nav-vertical-tabs component */
@@ -160,6 +184,10 @@ footer {
     border-radius: 4px 0 0 4px;
 }
 
+.navbar-nav {
+    margin-top: 30px;
+}
+
 .badge { background: #F2756A; }
 
 #nav-menu{
@@ -168,11 +196,34 @@ footer {
     right: 45px;
     z-index: 2000;
 }
+#nav-version{
+    position: fixed;
+    top: 45px;
+    right: 90px;
+    z-index: 2000;
+}
 #nav-menu .dropdown-menu {
     left: inherit;
     right: 0px;
 }
-
+#version-notice{
+    background-color: #30cad4;
+    padding: 5px 10px;
+    position: fixed;
+    top: 0;
+    left: 0;
+    width: 100%;
+    text-align: center;
+    color: #157380;
+    z-index: 9999;
+}
+#version-notice span {
+    color: #fff;
+}
+.version-toggle {
+    padding-top: 6px;
+    padding-bottom: 6px;
+}
 ul.dropdown-menu>li>a>i.fa {
     width: 1.3em;
 }
@@ -195,3 +246,15 @@ table th, table td {
 table th, table tr:nth-child(even) {
     background-color: #fefefe;
 }
+
+.fa-terminal:before {
+    padding-right: 5px;
+}
+
+@media (max-width: 768px) {
+    #version-notice {
+        top: 67px;
+        position: absolute;
+    }
+}
+

+ 0 - 3
feed.xml

@@ -1,6 +1,3 @@
----
-layout: none
----
 <?xml version="1.0" encoding="UTF-8"?>
 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 	<channel>

+ 11 - 11
index.html

@@ -3,24 +3,24 @@ layout: page
 tagline:
 ---
 
-{% for post in site.posts limit: 1 %}
+{% for page in site[site.latest_collection] limit: 1 %}
 
 <div class="page-header">
-  <h1>{{ post.title }} {% if post.tagline %} <small>{{ post.tagline }}</small>{% endif %}</h1>
+  <h1>{{ page.title }} {% if page.tagline %} <small>{{ page.tagline }}</small>{% endif %}</h1>
 </div>
 
 <article class="home">
 
   <div>
-    {% if post.fullview %}
-    {{ post.content }}
+    {% if page.fullview %}
+    {{ page.content }}
     {% else %}
-    {% if post.shortinfo %}
-    {{ post.shortinfo }}
-    {% elsif post.description %}
-    {{ post.description }}
+    {% if page.shortinfo %}
+    {{ page.shortinfo }}
+    {% elsif page.description %}
+    {{ page.description }}
     {% else %}
-    {{ post.excerpt }}
+    {{ page.excerpt }}
     {% endif %}
     {% endif %}
   </div>
@@ -29,9 +29,9 @@ tagline:
   <hr/>
 
   <ul class="pager"> 
-      {% if site.posts[1] %}
+      {% if site.version_4[1] %}
       <li class="next">
-        <a href="{{ site.BASE_PATH }}{{ site.posts[1].url }}" title="{{ site.posts[1].title }}">{{ site.posts[1].title }} &rarr;</a>
+        <a href="{{ site.BASE_PATH }}{{ site.version_4[1].url }}" title="{{ site.version_4[1].title }}">{{ site.version_4[1].title }} &rarr;</a>
       </li>
       {% endif %}
   </ul>