1. Go to this page and download the library: Download zeichen32/website-info library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zeichen32 / website-info example snippets
// Create a new WebsiteInfo instance with all default parser
$ws = \WebsiteInfo\Factory::createWithDefaultParser();
// OR
$ws = \WebsiteInfo\Factory::create(array(
new \WebsiteInfo\Parser\Webserver\Apache(),
new \WebsiteInfo\Parser\Webserver\Nginx(),
new \WebsiteInfo\Parser\Webserver\IIS(),
// ...
));
// Retrieve informations about wordpress.com
$result = $ws->get('http://wordpress.com');
print_r($result);
namespace Acme\Parser;
use WebsiteInfo\Event\ParseResponseEvent;
use WebsiteInfo\Parser\AbstractParser;
class MyParser extends AbstractParser {
public function onParseResponse(ParseResponseEvent $event)
{
// Get response object
$response = $event->getResponse();
// Do something with the response
$something = $this->doSomething( (string) $response->getBody() );
// Add a new section to the output container
$event->getData()->addSection('my_new_section', array(
'foo' => 'bar',
'version' => '1.0',
'score' => 1,
'raw' => $something
));
}
}
// Create a new WebsiteInfo instance
$ws = \WebsiteInfo\Factory::createWithDefaultParser();
// Register your parser
$ws->addParser(new \Acme\Parser\MyParser());
// Retrieve informations about wordpress.com
$result = $ws->get('http://wordpress.com');
// Create a new WebsiteInfo instance
$ws = \WebsiteInfo\Factory::createWithDefaultParser();
// Using the array cache
$ws->setCache(new \TwoDevs\Cache\ArrayCache());
// Retrieve informations about wordpress.com
$result = $ws->get('http://wordpress.com');
// Create a new WebsiteInfo instance
$ws = \WebsiteInfo\Factory::createWithDefaultParser();
// Create a new DoctrineCache instance
$doctrineCache = new \Doctrine\Common\Cache\FilesystemCache('var/cache');
// Create a new DoctrineCache adapter
$cacheAdapter = new \TwoDevs\Cache\DoctrineCache($doctrineCache);
// Using the cache
$ws->setCache($cacheAdapter);
// Retrieve informations about wordpress.com
$result = $ws->get('http://wordpress.com');
// Create a new WebsiteInfo instance
$ws = \WebsiteInfo\Factory::createWithDefaultParser();
// Create a new ZendStorage instance
$zendCache = new \Zend\Cache\Storage\Adapter\Memory();
// Create a new ZendCache adapter
$cacheAdapter = new \TwoDevs\Cache\ZendCache($zendCache);
// Using the cache
$ws->setCache($cacheAdapter);
// Retrieve informations about wordpress.com
$result = $ws->get('http://wordpress.com');
// Create a new Buzz Client
$buzz = new \Buzz\Browser();
// Create the client adapter
$client = new \Saxulum\HttpClient\Buzz\HttpClient($guzzle);
// Create a new WebsiteInfo instance with all default parser and custom client
$ws = \WebsiteInfo\Factory::createWithDefaultParser($client);
// Retrieve informations about wordpress.com
$result = $ws->get('http://wordpress.com');
print_r($result);
bash
$ php composer.phar
bash
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.