J
J
John2016-04-02 22:59:24
PHP
John, 2016-04-02 22:59:24

How to work with class?

Hello!
I have a question, there is a class:
DeleteTarget.php
pastebin.com/jkvV9LbY
How do I correctly pass the target id there so that everything works ??
I do it like this:
delete.php
pastebin.com/JD3n6vCy
only change a little in the class itself:

class DeleteTarget{

  //Server Keys
  private $access_key; // ставил public но ошибка не меняется
  private $secret_key;
  
  private $targetId;
  private $url 			= "https://vws.vuforia.com";
  private $requestPath 	= "/targets/";
  private $request;

but when I call I get an error:
9d28599b299f44868f613d1dcd38e409.jpg
delete.php <--- I turn here using Ajax, I thought that it was a problem, but when I call directly, everything is the same, but when I
specify the target and keys in the class itself, everything works fine!
{
result_code: "Success",
transaction_id: "7f0882c3d76b47bb9a87c0ddf339a83f"
}

Help solve the problem!
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Khan-Magomedov, 2016-04-02
@john_notebook

Your class uses an obsolete constructor form (instead of __constructor()), which also takes no arguments.
To delete in the constructor is a sin. Therefore, for deletion, it is better to make a separate method, which is then called (either after initialization, or a static method).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question