W
W
walkerstech2021-06-25 13:49:46
PHP
walkerstech, 2021-06-25 13:49:46

Decrypt POST request from AMOCRM?

POST request comes from AMOCRM:

contacts%5Badd%5D%5B0%5D%5Bid%5D=15484505&contacts%5Badd%5D%5B0%5D%5Bname%5D=asddasdas+asdsdaasdasd&contacts%5Badd%5D%5B0%5D%5Bresponsible_user_id%5D=6599971&contacts%5Badd%5D% 5B0%5D%5Bdate_create%5D=1624616493&contacts%5Badd%5D%5B0%5D%5Blast_modified%5D=1624616493&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B0%5D%5Bid%5D=446865&contacts%5D%5 5B0%5D%5Bcustom_fields%5D%5B0%5D%5Bname%5D=%D0%A2%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD&contacts%5Badd%5D%5B0 %5D%5Bcustom_fields%5D%5B0%5D%5Bvalues%5D%5B0%5D%5Bvalue%5D=%2B7%28879%29879-87-89&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B0%5D% 5Bvalues%5D%5B0%5D%5Benum%5D=276037&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B0%5D%5Bcode%5D=PHONE&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B1% 5D%5Bid%5D=446867&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B1%5D%5Bname%5D=Email&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B1%5D%5Bvalues%5D%5B0%5D%5Bvalue% 5D=demo%40mail.ru&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B1%5D%5Bvalues%5D%5B0%5D%5Benum%5D=276049&contacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D% 5B1%5D%5Bcode%5D=EMAIL&contacts%5Badd%5D%5B0%5D%5Bcreated_at%5D=1624616493&contacts%5Badd%5D%5B0%5D%5Bupdated_at%5D=1624616493&contacts%5Badd%5D%5B0%5D%5Btype%5D= contact&account%5Bsubdomain%5D=test&account%5Bid%5D=29198275&account%5B_links%5D%5Bself%5D=https%3A%2F%test.amocrm.rucontacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B1%5D%5Bcode%5D=EMAIL&contacts%5Badd%5D%5B0%5D%5Bcreated_at%5D=1624616493&contacts%5Badd%5D%5B0%5D%5Bupdated_at%5D= 1624616493&contacts%5Badd%5D%5B0%5D%5Btype%5D=contact&account%5Bsubdomain%5D=test&account%5Bid%5D=29198275&account%5B_links%5D%5Bself%5D=https%3A%2F%test.amocrm.rucontacts%5Badd%5D%5B0%5D%5Bcustom_fields%5D%5B1%5D%5Bcode%5D=EMAIL&contacts%5Badd%5D%5B0%5D%5Bcreated_at%5D=1624616493&contacts%5Badd%5D%5B0%5D%5Bupdated_at%5D= 1624616493&contacts%5Badd%5D%5B0%5D%5Btype%5D=contact&account%5Bsubdomain%5D=test&account%5Bid%5D=29198275&account%5B_links%5D%5Bself%5D=https%3A%2F%test.amocrm.ru

I tried to decrypt like this:
$email = $_POST['contacts']['add'][0]['custom_fields']['1']['values']['0']['value'];

But, accordingly, this variable is empty. I ask you to help. More precisely to help decipher.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Neverov, 2021-06-25
@TTATPuOT

Run the string through parse_str and get the array you want as an output.

S
Sergey, 2021-06-25
@sslion

In one of my hooks from amo, the processing starts like this:
60d5bcf27c1e5508389456.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question