• 07-07-2022, 22:00:32
    #1
    merhaba kullandığım betik budur

    $s = $_GET['u'];
    
    require_once 'google-api-php-client/vendor/autoload.php';
    
    $client = new Google_Client();
    
    // service_account_file.json is the private key that you created for your service account.
    $client->setAuthConfig('localindexingapi-8c.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": "$s",
      "type": "URL_UPDATED"
    }';
    
    $response = $httpClient->post($endpoint, [ 'body' => $content ]);
    $status_code = $response->getStatusCode();
    
    //print_r($response);
    echo "\n";
    echo "$status_code";
     "url": "$s",
    kısmını
      "url": "http://site.domain",
    yaptığımda sıkıntısız çalışıyor

    get yada post ile veri gönderidiğimde hiç bir şekilde çalıştıramadım nerede hata yapıyorum acaba :S
  • 08-07-2022, 05:04:16
    #2
    16. satırın olduğu kısmı şu şekilde değiştirin:
    $content = '{
      "url": "'.$s.'",
      "type": "URL_UPDATED"
    }';
  • 08-07-2022, 11:52:17
    #3
    Gece uğraştım baya json decode edip farklı bir dosya ile post edilmesi gerekiyormuş hallettim.
    Direk get yada post ile çalışmıyor.
  • 30-07-2022, 09:36:14
    #4
    hocam bu PHP siteye oluyormu acaba
  • 25-01-2023, 15:43:03
    #5
    Misafir adlı üyeden alıntı: mesajı görüntüle
    merhaba kullandığım betik budur

    $s = $_GET['u'];
    
    require_once 'google-api-php-client/vendor/autoload.php';
    
    $client = new Google_Client();
    
    // service_account_file.json is the private key that you created for your service account.
    $client->setAuthConfig('localindexingapi-8c.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": "$s",
      "type": "URL_UPDATED"
    }';
    
    $response = $httpClient->post($endpoint, [ 'body' => $content ]);
    $status_code = $response->getStatusCode();
    
    //print_r($response);
    echo "\n";
    echo "$status_code";
     "url": "$s",
    kısmını
      "url": "http://site.domain",
    yaptığımda sıkıntısız çalışıyor

    get yada post ile veri gönderidiğimde hiç bir şekilde çalıştıramadım nerede hata yapıyorum acaba :S
    Sorunun düzeldi mi? yardımcı olablir misin?