visual studio - POST http://localhost:60018/server.php 405 (Method Not Allowed) -




i getting error: angular.js:11756 post http://localhost:60018/server.php 405 (method not allowed)

i not familiar php code code friend wrote while ago project worked on, , wanted work on project on own bit , make better. unsure making happen, have tried looking stuff haven't used php before. code below, , ideas appreciated. , in case matters, running project on visual studios 2015

$ids = buildfinallist(); echo json_encode($ids);  function buildfinallist() {     $conn = dbconnect();     $type = 'themoviedb';     $input = json_decode(file_get_contents('php://input'), true);     $genre = $input['genres'];     $sources = $input['sources'];     $page = 1;      $result = array();      while (count($result) <= 2) {          $currentpage = generatelist($genre, $page++);         $idchecked = idcheck($conn, $currentpage, $type);         $sourcechecked = sourcecheck($conn, $idchecked, $sources);         $result = calcrating($sourcechecked, $result);     }      $conn->close();      $filmids = array();      foreach ($result $key => $value) {         array_push($filmids, $key);     }      return $filmids; }  function generatelist($genreid, $pagenum) {     $usurl = "http://api.themoviedb.org/3/discover/movie?";     $apikey = "api_key=9372ef92347b5703a397967af35f6c1c";     $genre = "&with_genres=" . $genreid;     $page = "&page=" . $pagenum;     $votes = "&vote_count.gte=50";     $endurl = "&sort_by=vote_average.desc";     $data1 = json_decode(file_get_contents($usurl.$apikey.$genre.$page.$votes.$endurl), true);     $data2 = $data1['results'];     $ids = array();     foreach ($data2 $result) {         array_push($ids, $result['id']);     }     return $ids; }  function dbconnect() {     $conn = new mysqli("localhost", "root", "", "movies");     if ($conn->connect_error) {         exit("server connection error");     }     return $conn; }  function idcheck($conn, $ids, $type) {      $results = array();      foreach ($ids $id) {         //database check         $query = "select * `filmids` ".$type."=\"".$id."\"";         $result = $conn->query($query);          if ($result->num_rows == 0) {             $guidecall = json_decode(file_get_contents             ('http://api-public.guidebox.com/v1.43/us/rks3n3vengt7cqc6d2w8y8tqytrvoaax/search/movie/id/'                 .$type.'/'.$id), true);              if (empty($guidecall) || empty($guidecall['imdb'])){                 continue;             } else {                 $in = "insert `filmids` (`imdb`, `themoviedb`, `guide`) values (\""                     .$guidecall["imdb"]."\", \"".$guidecall["themoviedb"]."\", \""                     .$guidecall["id"]."\")";                 $conn->query($in);                 $out = "select * `filmids` ".$type."=\"".$id."\"";                 $result = $conn->query($out);                 array_push($results, $result->fetch_assoc());             }         } else {             array_push($results, $result->fetch_assoc());         }     }      return $results; }  function sourcecheck($conn, $ids, $sources) {      $validfilms = array();      foreach ($ids $film) {         $query = "select * `sources` id=".$film['id'];         $result = $conn->query($query);          if ($result->num_rows == 0) {             $addrow = "insert `sources`(`id`) value (".$film['id'].")";             $conn->query($addrow);              $guidecall = json_decode(file_get_contents             ('http://api-public.guidebox.com/v1.43/us/rks3n3vengt7cqc6d2w8y8tqytrvoaax/movie/'                 . $film['guide']), true);              $websources = $guidecall['subscription_web_sources'];             $truesources = array();              foreach ($websources $websource) {                 array_push($truesources, $websource['source']);             }              foreach ($truesources $truesource) {                 $query = "update `sources` set `".$truesource."` = \"".$truesource."\" `id`=".$film['id'];                 $check = $conn->query($query);                 if ($check) {                     continue;                 } else {                     $conn->query("alter table `sources` add `".$truesource."` varchar(255)");                     $conn->query($query);                 }             }              if (count(array_diff($sources, $truesources)) < count($sources)) {                 array_push($validfilms, $film);             }          } else {             if (count(array_diff($sources, $result->fetch_assoc())) < count($sources)) {                 array_push($validfilms, $film);             }         }     }     return $validfilms; }  function calcrating($films, $sorted) {      foreach ($films $film) {          $omdb = json_decode(file_get_contents("http://www.theimdbapi.org/api/movie?movie_id=".$film['imdb']), true);          $rating = ($omdb['rating']);          $film['rating'] = $rating;          $sorted[$film['imdb']] = $rating;      }      arsort($sorted);      return $sorted;  } 

as update situation, seem have gotten php installed on machine, when put file named phpinfo.php line in wwwroot folder, nice page display has php settings. how still seem 405 error when running whole application , still involving server.php file have in project.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -