• 06-04-2022, 22:17:02
    #1
    Php siteye Google index api kurulumu yaptım, ancak $link değişkenini kullanamıyorum. Nerede hata yapıyorum acaba.

    <?php 
    require_once 'autoload.php';
    
    $link = "https://siteadi.net/test-test";
    
    $client = new Google_Client();
    
    // service_account_file.json is the private key that you created for your service account.
    $client->setAuthConfig('geopa-346408-287ffcc26f34.json');
    $client->addScope('https://www.googleapis.com/auth/indexing');
    
    // Get a Guzzle HTTP Client
    $httpClient = $client->authorize();
    $endpoint = 'https://indexing.googleapis.com/v3/urlNotifications:publish';
    
    // Define contents here. The structure of the content is described in the next step.
    $content = '{
      "url": $link,
      "type": "URL_UPDATED"
    }';
    
    $response = $httpClient->post($endpoint, [ 'body' => $content ]);
    echo $status_code = $response->getStatusCode();
    
    
     ?>
  • 06-04-2022, 22:30:14
    #2
    $content değişkenin başındaki tek tırnaktan dolayı sanırım
    faydalı olduysa R10+ verebilirsiniz
  • 06-04-2022, 22:35:10
    #3
    Hersio adlı üyeden alıntı: mesajı görüntüle
    $content değişkenin başındaki tek tırnaktan dolayı sanırım
    faydalı olduysa R10+ verebilirsiniz
    Malesef olmadı, Tırnakları alınca, hata verdi, Yinede zahmet edip yorum yaprınız , r10+, Teşekkürler.
  • 06-04-2022, 22:38:24
    #4
    pisipisi adlı üyeden alıntı: mesajı görüntüle
    Malesef olmadı, Tırnakları alınca, hata verdi, Yinede zahmet edip yorum yaprınız , r10+, Teşekkürler.
    tek tırnağı çift tırnağa çevirin süslü parantez içindeki çift tırnaklıları tek tırnağa çevirin.
  • 06-04-2022, 22:42:24
    #5
    Hersio adlı üyeden alıntı: mesajı görüntüle
    tek tırnağı çift tırnağa çevirin süslü parantez içindeki çift tırnaklıları tek tırnağa çevirin.

    $content = "{
    'url': '{$link}',
    'type': 'URL_UPDATED'
    }";

    Bu şekilde çalıştı teşekkürler...
  • 06-04-2022, 22:42:49
    #6
    $content = "{
      'url': '{$link}',
      'type': 'URL_UPDATED'
    }";