I've just started to start experiment with the BP API. I have set up a local apache server on my PC, and installed Visual Studio Code.
I've started with the bluepark_api_client.php example file, I've added the API code and user name etc, and added an order number.
So as-is, with no other changes this should go to the website and return details of the given order.
And that is what it does, it returns the order details and displays them on the screen as it is supposed to. However, it also displays 2 errors (or "warnings") -
Now I'm not a PHP coder, I'm just looking at the code trying to figure out what it does. The first one seems to be trying to break text down into a key and a value based on ":" as a separator, but the first line is "HTTP/1.1 200 OK" which has no separator. A few lines before that is this code, which looks like a recognition of that issue?
If so it just seems a bit messy to start the loop on the first line, knowing that line always fails. Or am I misunderstanding that?
The 2nd problem seems to be that it doesn't recognise "error" in the $content variable, which appears to be because it doesn't exist. I assume that maybe it only exists if there has actually been an error. But again if so it seems a bit messy that an error handler would itself error if there were no error...?
Ideally I would like to resolve the errors so everything is working error free before I start modifying / adding stuff, but I'm not sure I can do anything about these, should I just ignore them or is it indicating that something needs to be fixed?
I've started with the bluepark_api_client.php example file, I've added the API code and user name etc, and added an order number.
So as-is, with no other changes this should go to the website and return details of the given order.
And that is what it does, it returns the order details and displays them on the screen as it is supposed to. However, it also displays 2 errors (or "warnings") -
Code:
[COLOR=#000000][FONT=&]Warning: Undefined array key 1 in C:\xampp\htdocs\BluePark\bluepark_api_client.php on line [/FONT][/COLOR][I]322[/I]
Code:
[COLOR=#000000][FONT=&]Warning: Undefined array key "error" in C:\xampp\htdocs\BluePark\bluepark_api_client.php on line [/FONT][/COLOR][I]331[/I]
PHP Code:
$headers = array("Status" => trim($lines[0]));
The 2nd problem seems to be that it doesn't recognise "error" in the $content variable, which appears to be because it doesn't exist. I assume that maybe it only exists if there has actually been an error. But again if so it seems a bit messy that an error handler would itself error if there were no error...?
Ideally I would like to resolve the errors so everything is working error free before I start modifying / adding stuff, but I'm not sure I can do anything about these, should I just ignore them or is it indicating that something needs to be fixed?