Exemplo n.º 1
0
    <link rel="stylesheet" href="/examples/Disk/css/style.css">
</head>
<body>
<div class="container">
    <div class="jumbotron">
        <h2><span class="glyphicon glyphicon-search"></span> Пример работы с Яндекс Пингером</h2>
    </div>
    <div class="col-md-8">
        <ol class="breadcrumb">
            <li><a href="/examples">Examples</a></li>
            <li class="active">SiteSearchPinger</li>
        </ol>
        <?php 
try {
    $settings = (require_once '../settings.php');
    $pinger = new SiteSearchPinger();
    if (!isset($settings["pinger"]["key"]) || !$settings["pinger"]["key"]) {
        throw new SiteSearchPingerException('Empty pinger key');
    }
    if (!isset($settings["pinger"]["login"]) || !$settings["pinger"]["login"]) {
        throw new SiteSearchPingerException('Empty pinger key');
    }
    if (!isset($settings["pinger"]["searchId"]) || !$settings["pinger"]["searchId"]) {
        throw new SiteSearchPingerException('Empty pinger key');
    }
    $pinger->key = $settings["pinger"]["key"];
    $pinger->login = $settings["pinger"]["login"];
    $pinger->searchId = $settings["pinger"]["searchId"];
    $url = ["http://anton.shevchuk.name/php/php-development-environment-under-macos/", "http://anton.shevchuk.name/php/php-framework-bluz-update/", "http://ya.ru", "http://yandex.ru", "yaru", "yarus"];
    $added = $pinger->ping($url);
    echo "OK. " . $added . " from " . sizeof($url) . " urls was added to queue<br/>";
 public function testInvalidSettingsException()
 {
     $siteSearchPinger = new SiteSearchPinger();
     $this->setExpectedException('Yandex\\Common\\Exception\\InvalidSettingsException');
     $siteSearchPinger->ping($this->fixtureUrls);
 }