trying to code a simple parser to get info for my robot. the code is simple. but in return i only get “You don’t have permission to access this resource.” not the source code like i see in my web browser
using System;
using System.Net.Http;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
using (var client = new HttpClient())
{
var endpoint = new Uri("https://www.investing.com/economic-calendar/");
var result = client.GetAsync(endpoint).Result;
var json = result.Content.ReadAsStringAsync().Result;
}
}
}
}
full data that contains json variable looks like
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
<script>(function(){if (!document.body) return;var js = "window['__CF$cv$params']={r:'88e838692a8f9d5a',t:'MTcxNzUwNzIyNy4yNjMwMDA='};_cpo=document.createElement('script');_cpo.nonce='',_cpo.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js',document.getElementsByTagName('head')[0].appendChild(_cpo);";var _0xh = document.createElement('iframe');_0xh.height = 1;_0xh.width = 1;_0xh.style.position = 'absolute';_0xh.style.top = 0;_0xh.style.left = 0;_0xh.style.border = 'none';_0xh.style.visibility = 'hidden';document.body.appendChild(_0xh);function handler() {var _0xi = _0xh.contentDocument || _0xh.contentWindow.document;if (_0xi) {var _0xj = _0xi.createElement('script');_0xj.innerHTML = js;_0xi.getElementsByTagName('head')[0].appendChild(_0xj);}}if (document.readyState !== 'loading') {handler();} else if (window.addEventListener) {document.addEventListener('DOMContentLoaded', handler);} else {var prev = document.onreadystatechange || function () {};document.onreadystatechange = function (e) {prev(e);if (document.readyState !== 'loading') {document.onreadystatechange = prev;handler();}};}})();</script></body></html>
can someone help me to get full code like in browser?
New contributor
Николай Борисов is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.