title: How do I Convert this Ajax Post request to C#
body: <p>I'm making a project in c# to get a facebook ID from any facebook URL. I an API that can helps but the code is using this Ajax POST code:</p>
  
  <pre><code>        // get facebook id
      $('#get-facebook-id').submit(function(event) {
  
          $('#answer').html("&lt;b&gt;Working for you...&lt;/b&gt;");
  
          $.ajax({
              type: 'POST',
              url: 'https://codeofaninja.com/tools/get-facebook-id-answer.php',
              data: $(this).serialize()
          })
          .done(function(data){
              $('#answer').html(data);
              $('#page_url_tb').val('')
          })
          .fail(function() {
              alert( "Posting failed. Please try again." );
          });
  
          return false;
      });
  </code></pre>
  
  <p>I'm trying to make my own code but is giving me an error. My code and my error down bellow.</p>
  
  <pre><code>private string getFbAccountID(string facebookurl)
      {
          var request = (HttpWebRequest)WebRequest.Create("https://codeofaninja.com/tools/get-facebook-id-answer.php");
  
          var postData = "page_url="+facebookurl;
          var data = Encoding.ASCII.GetBytes(postData);
  
          request.Method = "POST";
          request.ContentType = "application/x-www-form-urlencoded";
          request.ContentLength = data.Length;
  
          using (var stream = request.GetRequestStream())
          {
              stream.Write(data, 0, data.Length);
          }
  
          var response = (HttpWebResponse)request.GetResponse();
  
          var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
          return responseString;
      }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>    &lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined index: page_url in &lt;b&gt;/home/100661.cloudwaysapps.com/rpxdhcedbx/public_html/tools/get-facebook-id-answer.php&lt;/b&gt; on line &lt;b&gt;3&lt;/b&gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined offset: 1 in &lt;b&gt;/home/100661.cloudwaysapps.com/rpxdhcedbx/public_html/tools/get-facebook-id-answer.php&lt;/b&gt; on line &lt;b&gt;19&lt;/b&gt;&lt;br /&gt;
  &lt;p&gt;There was an error. Please try a different input.&lt;/p&gt;
  </code></pre>
  
  <p>This is always giving me this error. I hope someone can helps me</p>