<?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();
?> Php Değişkeni Alamıyorum....
5
●166
- 06-04-2022, 22:17:02Php siteye Google index api kurulumu yaptım, ancak $link değişkenini kullanamıyorum. Nerede hata yapıyorum acaba.
- 06-04-2022, 22:35:10Malesef olmadı, Tırnakları alınca, hata verdi, Yinede zahmet edip yorum yaprınız , r10+, Teşekkürler.Hersio adlı üyeden alıntı: mesajı görüntüle
- 06-04-2022, 22:38:24tek tırnağı çift tırnağa çevirin süslü parantez içindeki çift tırnaklıları tek tırnağa çevirin.pisipisi adlı üyeden alıntı: mesajı görüntüle
- 06-04-2022, 22:42:24Hersio adlı üyeden alıntı: mesajı görüntüle
$content = "{
'url': '{$link}',
'type': 'URL_UPDATED'
}";
Bu şekilde çalıştı teşekkürler...