2017 © Pedro Peláez
 

symfony-bundle html-meta-crawler-bundle

A simple bundle to get meta tag from url

image

gkueny/html-meta-crawler-bundle

A simple bundle to get meta tag from url

  • Wednesday, June 29, 2016
  • by gkueny
  • Repository
  • 1 Watchers
  • 2 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

SensioLabsInsight, (*1)

Installation

New

June 29 2016 :

Add getOpenGraph function, (*2)

I try to imitate facebook crawler, (*3)

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*4)

$ composer require gkueny/html-meta-crawler-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*5)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*6)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new GK\HtmlMetaCrawlerBundle\GKHtmlMetaCrawlerBundle(),
        );

        // ...
    }

    // ...
}

Controller Example


<?php namespace GK\HtmlCrawlerBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; /** * Class DefaultController * * @package GK\HtmlCrawlerBundle\Controller */ class DefaultController extends Controller { /** * @Route("/", name="crawler_homepage") * * @return Response */ public function indexAction() { $url = 'http://gkeny.fr'; try { $myMetasFb = $this->get("gk.html_meta_crawler")->getMetaFacebook($url); $myMetasTw = $this->get("gk.html_meta_crawler")->getMetaTwitter($url); $myMetasBasic = $this->get("gk.html_meta_crawler")->getBasicMeta($url); $myMetasAll = $this->get("gk.html_meta_crawler")->getAllMeta($url); } catch (Exception $e) { echo $e->getMessage(); exit; } echo "<p> Facebook : <br/>"; foreach ($myMetasFb as $myMeta ) { echo $myMeta['property'] . " = " . $myMeta['content'] . '<br/>'; } echo "</p>"; echo "<p> Twitter : <br/>"; foreach ($myMetasTw as $myMeta ) { echo $myMeta['name'] . " = " . $myMeta['content'] . '<br/>'; } echo "</p>"; echo "<p> Basic : <br/>"; foreach ($myMetasBasic as $myMeta ) { print_r($myMeta); echo "<br/>"; } echo "</p>"; echo "<p> All : <br/>"; foreach ($myMetasAll as $myMeta ) { print_r($myMeta); echo "<br/>"; } echo "</p>"; exit; } }

The Versions

29/06 2016

dev-master

9999999-dev

A simple bundle to get meta tag from url

  Sources   Download

MIT

by Avatar gkueny

html crawler meta bundle

29/06 2016

v0.3.0

0.3.0.0

A simple bundle to get meta tag from url

  Sources   Download

MIT

by Avatar gkueny

html crawler meta bundle

15/06 2016

0.2.0

0.2.0.0

A simple bundle to get meta tag from url

  Sources   Download

MIT

by Avatar gkueny

html crawler meta bundle

06/06 2016

0.1.1

0.1.1.0

A simple bundle to get meta tag from url

  Sources   Download

MIT

by Avatar gkueny

html crawler meta bundle

06/06 2016

0.1.0

0.1.0.0

A simple bundle to get meta tag from url

  Sources   Download

MIT

by Avatar gkueny

html crawler meta bundle