50٪ تخفیف روی تمام دوره‌ها!
پایان تخفیف تا:
مشاهده دوره‌ها
0

تبدیل زبان

سلام دوستان عزیز یکی می تواند یک قطعه کد php برای من به سی شارپ بنویسید

$url = 'https://arzoonlike.ir/api/v2';
	$ch = curl_init($url);	
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS,
				'key="YOURKEY"&action="ACTION"&service="SERVICE NUMBER"&link="YOUR LINK"&amount="COUNT"');
					
		curl_setopt($ch, CURLOPT_POST, 1);
	 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch); 
	

پرسیده شده در 1398/03/06 توسط

2 پاسخ

0

مرسی فقط از این خط کد ایراد میگیره

var response = await client.PostAsJsonAsync(
                "/api/v2", data);
پاسخ در 1398/03/11 توسط
0

سلام به شما دوست عزیز.

یک پروژه از نوع windows form application بسازید و یک دکمه بر روی آن قرار دهید سپس در قسمت کد دستورات زیر را بنویسید. دقت داشته باشید که ورژن دات نت شما بر روی 4.7 باشد.

using System;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;

namespace WindowsFormsTestApi
{
   public class Data
    {
        public string key { get; set; }
        public string action { get; set; }
        public string service { get; set; }
        public string link { get; set; }
        public int amount { get; set; }
    }
    public partial class Form1 : Form
    {
        static HttpClient client = new HttpClient();
 public Form1()
        {
            InitializeComponent();
        }
        static async Task<Uri> PostAsync(Data data)
        {
            var response = await client.PostAsJsonAsync(
                "/api/v2", data);
            response.EnsureSuccessStatusCode();

            // return URI of the created resource.
            return response.Headers.Location;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            client.BaseAddress = new Uri("https://arzoonlike.ir");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));
            var data = new Data
            {
                action = "yout action0",
                amount = 0,
                key = "yout key",
                link = "your link",
                service = "your service"
            };
            var result =  PostAsync(data);
        }
}
}

پاسخ در 1398/03/07 توسط

پاسخ شما