title: using a PHP file i am inserting data to wordpress from an unity project, While it works on my local machine, it doesn't once i upload to live server
body: <p>Using a PHP file I am inserting data to WordPress from a unity project, While it works on my local machine, it doesn't once i upload to live server.</p>
  
  <p>Any Ideas what I am doing wrong?</p>
  
  <p>also the php file is located at the root directory of wordpress in the server /var/www/html/</p>
  
  <p>Thanks
  Seb</p>
  
  <pre><code>&lt;?php
  
  global $wpdb;
  $servername = "localhost";
  $username =  "root";
  $password = "*****";
  $dbName = "*****";
  
  //$servername = "localhost";
  //$username =  "root";
  //$password = "";
  //$dbName = "testdb";
  
  //$userTitle = $_POST["userFullNamePost"];
  //$userPoem = $_POST["userPoemPost"];
  
  $userTitle = "katherine";
  $userPoem = "mansifeld asdlfkjadf asdfadfkj asfdaklsdjf adfkajdfkladf akldsfj";
  $post_name = "wellington";
  $post_author = "1";
  $post_date = "2018-02-25 08:54:11";
  $post_date_gmt = "2018-02-25 08:54:11";
  $post_modified = "2018-02-25 08:54:11";
  $post_modified_gmt = "2018-02-25 08:54:11";
  
  
  //Make Connection
  $conn = new mysqli($servername, $username, $password, $dbName);
  //Check Connection
  if(!$conn){
    die("Connection Failed. ". mysqli_connect_error());
  }
  
  $sql = "INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt)
          VALUES ('". $post_author ."','". $post_date ."','". $post_date_gmt ."','". $userPoem ."','". $userTitle ."','". $post_name ."','". $post_date ."','". $post_date_gmt ."','". $post_modified ."','". $post_modified_gmt ."')";
  
  //$wpdb-&gt;prepare("INSERT INTO 'wp_posts' ('post_title', 'post_content', 'post_name', 'post_author', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt')
  //VALUES ('$userTitle','$userPoem','$post_name','$post_author','$post_date','$post_date_gmt','$post_modified','$post_modified_gmt')");
  //
  $result = mysqli_query($conn ,$sql);
  
  
  if (!result) echo "there was an error";
  else echo "everything ok should be";
  
  $conn-&gt;close();
  ?&gt;
  </code></pre>