I would like know why when I access a website by console or power shell the metrics of my website don't change.
I have a wordpress website. I'm using jetpack to log all access in my website. I created a console application to see if I can improve the number of access in my page. But I cant.
I used this code:
// Create web client simulating IE6.
using (WebClient client = new WebClient())
{
client.Headers["User-Agent"] =
"Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) " +
"(compatible; MSIE 6.0; Windows NT 5.1; " +
".NET CLR 1.1.4322; .NET CLR 2.0.50727)";
// Download data.
byte[] arr = client.DownloadData("http://www.website.com/");
// Write values.
Console.WriteLine("--- WebClient result ---");
Console.WriteLine(arr.Length);
}
Also I tried it with a Power Shell script.
echo 'begin'
# First we create the request.
for($i=1; $i -le 1000; $i++){
$HTTP_Request = [System.Net.WebRequest]::Create('http://www.website.com')
# We then get a response from the site.
$HTTP_Response = $HTTP_Request.GetResponse()
# We then get the HTTP code as an integer.
$HTTP_Status = [int]$HTTP_Response.StatusCode
If ($HTTP_Status -eq 200) {
Write-Host "Site is OK!" + $i
}
Else {
Write-Host "The Site may be down, please check!"
}
$HTTP_Response.Close()
}
Write-Host -Object ('The key that was pressed was: {0}' -f [System.Console]::ReadKey().Key.ToString());
# Finally, we clean up the http request by closing it.
In both cases I was able to get any new access. What I have to do to simulate the access from a browser?
Aucun commentaire:
Enregistrer un commentaire