# Checks each URL in backlinks_raw.txt for presence of 'biharfuture.com' in page content. # Outputs CSV to backlink_check_results.csv $in = "backlinks_raw.txt" $out = "backlink_check_results.csv" if (-not (Test-Path $in)) { Write-Error "$in not found in current directory" exit 1 } "URL,Status,ContainsLink,Note" | Out-File -FilePath $out -Encoding utf8 Get-Content $in | Where-Object { $_ -and $_.Trim() -ne "" } | ForEach-Object -Parallel { param($url, $out) } -ArgumentList $_, $out -ThrottleLimit 5 # Fallback serial processing (safer across PowerShell versions) Get-Content $in | Where-Object { $_ -and $_.Trim() -ne "" } | ForEach-Object { $url = $_.Trim() try { $headers = @{ 'User-Agent' = 'Mozilla/5.0 (compatible; Bingbot/2.0; +http://www.bing.com/bingbot.htm)'} $resp = Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headers -TimeoutSec 15 -ErrorAction Stop $status = $resp.StatusCode.ToString() $body = $resp.Content if ($body -match 'biharfuture\.com' -or $body -match 'biharfuture') { $contains = 'YES' $note = '' } else { $contains = 'NO' $note = '' } } catch { $status = 'ERROR' $contains = 'NO' $note = $_.Exception.Message -replace '"','""' } $line = '"' + $url + '",' + $status + ',' + $contains + ',"' + $note + '"' $line | Out-File -FilePath $out -Encoding utf8 -Append Write-Output $line } Write-Output "Results written to $out"