title: internal server error on XMLHttpRequest
body: <p>I have a chrome extension that only runs on Facebook and I am trying to send data that the extension gathers to a MySQL database that I have on my GoDaddy website server. I keep getting the error message "Failed to load resource: the server responded with a status of 500 (Internal Server Error)". I wasn't sure what the issue is since I'm just getting into web development.
  Here is my code for the content script on my chrome extension:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var dummyUrl = new URL ("http://www.bbc.com/news/world-us-canada-41081629");
    console.log("dummyUrl: " + dummyUrl);
    //Create XMLHttpRequest Object
    var xhttp = new XMLHttpRequest();
    //Send request
    xhttp.open("POST", "https://pocketchange.social/data.php", true);
    xhttp.send(dummyUrl);</code></pre>
  </div>
  </div>
  </p>
  
  <p>And here is my PHP file on my webserver that is running a query to send the data to my database:</p>
  
  <pre><code>&lt;?php 
  $mysqli = new mysqli("localhost", "Jarid", "Database", "myURL");
  
  //Check connection
  if(mysqli === false) {
      die("ERROR: Could not connect" . $mysqli-&gt;connect_error;
  }
  
  //Print host information
  echo "Connection successful. Host info: " . $mysqli-&gt;host_info;
  
  //Escape user inputs
  $url = $mysqli-&gt;real_escape_string($_REQUEST['url']);
  $description = $mysqli-&gt;real_escape_string($_REQUEST['description']);
  $keywords = $mysqli-&gt;real_escape_string($_REQUEST['keywords']);
  $content = $mysqli-&gt;real_escape_string($_REQUEST['content']);
  $language = $mysqli-&gt;real_escape_string($_REQUEST['language']);
  
  //Execute query
  $query = "INSERT INTO url_data (url, description, keywords, content, language) VALUES ('$url', '$description', '$keywords', '$content', '$language')";
  
  //Checking to see if values were inserted properly
  if($mysqli-&gt;query($query) === true) {
      echo "Data successfully inserted.";
  }
  else {
      echo "ERROR could not execute query" . $mysqli-&gt;error;
  } 
  
  $mysqli-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>Is my issue mainly that I'm trying to send data to a completely different server? I'm not super clear on how all of these pieces communicate with each other (ie how does the chrome extension know how to connect to the GoDaddy server, and how exactly is the php file sending data to the database, etc.)
  Thanks in advance.</p>