IATA and ICAO

БЕЗКОШТОВНО
(Ким) leopieters | Оновлено 5 months ago | Travel
Популярність

0.4 / 10

Затримки

477ms

Рівень обслуговування

100%

Повернутися до всіх обговорень

Keep getting `SQLSTATE[42000]: Syntax error or access violation` error

A
abhig01
4 years ago

Below is my code

	Unirest\Request::verifyPeer(false);
	$response = Unirest\Request::get("https://leopieters-iata-and-icao-v1.p.mashape.com/airportDatabase?codeIataAirport=BOM&key='".MASHAPE_IATA_CODE_API_KEY."'",
		array(
			"X-Mashape-Key" => MASHAPE_IATA_CODE_API_KEY,
			"Accept" => "text/plain"
		));

	print_r($response);

Here is the response

    Unirest\Response Object
    (
        [code] => 200
        [raw_body] => {"error": {"text": SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{key}''' at line 1}
        [body] => {"error": {"text": SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{key}''' at line 1}
        [headers] => Array
            (
                [0] => HTTP/1.1 200 OK
                [Access-Control-Allow-Headers] => X-Requested-With, Content-Type, Accept, Origin, Authorization
                [Access-Control-Allow-Methods] => GET, POST, PUT, DELETE, OPTIONS
                [Access-Control-Allow-Origin] => *
                [Content-Type] => text/html; charset=UTF-8
                [Date] => Sat, 03 Feb 2018 06:46:51 GMT
                [Host-Header] => 192fc2e7e50945beb8231a492d6a8024
                [Server] => Mashape/5.0.6
                [X-Proxy-Cache] => MISS
                [Content-Length] => 274
                [Connection] => keep-alive
            )
    )

Приєднуйтесь до обговорення — додайте повідомлення нижче:

Вхід / Реєстрація, щоб публікувати нові повідомлення
Рейтинг: 2.6 - Голосів: 5