<?php
//header('Access-Control-Allow-Origin: *');

header('Access-Control-Allow-Headers: //coopervision.com.tw, X-Requested-With, Content-Type, Accept');

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');



$servername = "coopervision.cloudwps.net";

$username = "cloudwps_cv";

$password = "cooper@2019";

$dbname = "cloudwps_coopervision";



// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

$conn->set_charset('utf8mb4');

// Check connection

if ($conn->connect_error) {

    die("Connection failed: " . $conn->connect_error);

} 



$sql = "SELECT * FROM twoutlets";

$result = $conn->query($sql);

$json = array();



if ($result->num_rows > 0) {

    // output data of each row

    while($row = $result->fetch_assoc()) {

       $json[] = $row;

    }

    echo json_encode($json);

} else {

    echo "0 results";

}

$conn->close();