1
Posted on 3:31 AM by Softminer and filed under

static void Main(string[] internal args)

        {
            //           https://www.cloudflare.com/api_json.html \
            //  -d 'a=zone_file_purge' \
            //-d 'tkn=8afbe6dea02407989af4dd4c97bb6e25' \
            //-d 'email=sample@example.com' \
            //-d 'z=example.com' \
            //-d 'url=http://www.example.com/style.css'

             // Create a request using a URL that can receive a post.
            WebRequest request = WebRequest.Create ("https://www.cloudflare.com/api_json.html");
             request.Proxy = null;
            request.Credentials = CredentialCache.DefaultCredentials;

            //ServicePointManager.ServerCertificateValidationCallback +=
            new  System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);

            // Set the Method property of the request to POST.
            request.Method = "POST";
            // Create POST data and convert it to a byte array.
            string postData = string.Format("a={0}&tkn={1}&email={2}&z={3}&url={4}", );

            byte[] internal byteArray = Encoding.UTF8.GetBytes (postData);

            // Set the ContentType property of the WebRequest.
            request.ContentType = "application/x-www-form-urlencoded";
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;
            // Get the request stream.
            Stream dataStream = request.GetRequestStream ();
            // Write the data to the request stream.
            dataStream.Write (byteArray, 0, byteArray.Length);
            // Close the Stream object.
            dataStream.Close ();
            // Get the response.
            WebResponse response = request.GetResponse ();
            // Display the status.
            Console.WriteLine (((HttpWebResponse)response).StatusDescription);
            // Get the stream containing content returned by the server.
            dataStream = response.GetResponseStream ();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader (dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd ();
            // Display the content.
            Console.WriteLine (responseFromServer);
            // Clean up the streams.
            reader.Close ();
            dataStream.Close ();
            response.Close ();
}

        public static bool ValidateServerCertificate(object sender,
	X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            return true;
        }
1
Response to ... Cloudflare api C#
Project said... July 25, 2020 at 9:22 PM

Great Article
Cloud Computing Projects


Networking Projects

Final Year Projects for CSE


JavaScript Training in Chennai

JavaScript Training in Chennai

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training