0

Problem 1 This is my nested array code

        $product = $db->query("SELECT * FROM product")->fetchAll(PDO::FETCH_OBJ);

        return $response
        ->withStatus(200)
        ->withHeader("Content-Type", 'application/json')
        ->withJson($product);

output

[
{
"product_id": "1",
"product_name": "Ahmet",
"product_price": "10.00",
"product_status": "",
"product_slung": "",
"product_property": "{\"p1\": 1, \"p2\": \"Leanne Graham\", \"o3\": \"Bret\"}",
"product_createdtime": "{\"date\": \"06.05.2020\", \"time\": \"23:19\"}"
}
]

{\"p1\": 1, \"p2\": \"Leanne Graham\", \"o3\": \"Bret\"} adding \ problem

Problem 2 No problem when you enter this way http://as.localhost/api/product/ When I enter this way, I get such an error http://as.localhost/api/product "Page Not Found"

  • Does this answer your question? [Setting up SSL on a local xampp/apache server](https://stackoverflow.com/questions/2643462/setting-up-ssl-on-a-local-xampp-apache-server) – Daniel Brose May 06 '20 at 23:53
  • I don't think the problem is due to SSL, but I'll try. – Burak Alaca May 07 '20 at 00:17
  • if its not that your localhost isnt configured for SSL, or that you havent mapped the SSL port (not just port 80) to that localhost subdomain, then thats critical information to include above, with proof on how other https pages on SAME domain do work. – Daniel Brose May 07 '20 at 00:26
  • i am sorry, my problem is not solved – Burak Alaca May 07 '20 at 02:02
  • Please add route definition for `/api/product`. Also, clarify problem 1 by adding the value of `$product` and expected json output. – Nima May 07 '20 at 04:28
  • Problem 1 ```[ { "product_id": "1", "product_name": "Ahmet", "product_price": "10.00", "product_status": "", "product_slung": "", "product_property": "{\"p1\": 1, \"p2\": \"Leanne Graham\", \"o3\": \"Bret\"}", "product_createdtime": "{\"date\": \"06.05.2020\", \"time\": \"23:19\"}" } ] "product_property": "{\"p1\": 1, \"p2\": \"Leanne Graham\", \"o3\": \"Bret\"}", ``` backslash problem Problem 2 Route Code ```$app->get('/product/', function ($request, $response, $id) { // code }); ``` @Nima – Burak Alaca May 07 '20 at 11:27
  • Please show us your route for `api/product`. – odan May 09 '20 at 10:10

0 Answers0