TALK FOR WEB LLP

Submit bulk URL’s in Bing for indexing

Submit bulk URL's in Bing for indexing
Submit URL’s in Bing is very simple as compared to other search engines.

Bing called IndexNow which is the industry standard that helps you easily notify search engines about your latest site content.

There is many plugins available in different opensources but if you want to use this in code PHP code below is easy and running code example.
Download key file from https://www.bing.com/indexnow and upload into your server, change key value in below code.

                            $pdo = con();
                           
                            $pattern = 'in';
                            $sql = "SELECT * FROM big_data WHERE country = :pattern AND id > 67811  ORDER BY id ASC limit 500";
                            $statement = $pdo->prepare($sql);
                            $statement->execute([':pattern' => $pattern]);
                            $res = $statement->fetchAll(PDO::FETCH_ASSOC);

                            foreach($res as $r){ 
                                $url = url($r['id'], $r['plink'], $r);
                                $urls[]= 'https://www.talkforweb.in'.$url;
                             }


$IndexNowKey = "df71a7e2a26a44d89f1a5b6c8d3bb999"; 
$uRoor = "www.haveinlist.com"; 
$uHttps = "https"; 
$uEngine = "www.bing.com";  
$uRLS = "".$uHttps."://$uRoor/"; 
$data = array('host' => "$uRoor", 'key' => "$IndexNowKey", 'keyLocation' => "".$uRLS."".$IndexNowKey.".txt", 'urlList' =>array_reverse(array_reverse($urls)));

$ch = curl_init("https://$uEngine/indexnow");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json; charset=utf-8'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
$res = curl_exec($ch);
$http_code = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$res = json_encode($res, JSON_UNESCAPED_UNICODE);
 if ($http_code == 200) { echo "Response -$http_code List URL sent successfully"; }
 elseif ($http_code == 202) { echo "Response -$http_code Accepted. received, pending verification of key IndexNow"; }
 elseif ($http_code == 400) { echo "Response -$http_code Bad request. Bad format"; }
 elseif ($http_code == 403) { echo "Response -$http_code Forbidden. Invalid key (e.g. key not found, file found , but the key is not in the file)"; }
 elseif ($http_code == 422) { echo "Response -$http_code Unprocessed object. URLs do not belong to host or key does not match scheme in protocol"; }
 elseif ($http_code == 429) { echo "Response -$http_code Too many requests. Counted as potential spam"; }
 else { echo "$http_code - Error sending URL list"; }
Share this post:
You may also like:
automation tool windows 11

Know your Windows 11

Windows 11 Automation tool, easily hijacked Robotizing Ordinary WORK errands has become more straightforward throughout recent years. Utilizing simplified robotization programming, you can follow your

Read More »