R
R
redd_i2018-08-21 15:17:50
PHP
redd_i, 2018-08-21 15:17:50

How to pass data through the API correctly?

Hello. It is necessary to transfer data from my site to the program. Their API: https://docs.google.com/document/d/1gs81CYvJ6FD9KO...
My script:

<?php

$url = 'https://app.frontpad.ru/api/index.php?new_order';

$params = array(
        'secret' => 'тут мой ключ', 
        'product' => 'Калифорния Тунец',
    );

$result = file_get_contents($url, false, stream_context_create(array(
        'http' => array(
            'method'  => 'POST',
            'content' => http_build_query($params)
        )
    )));

echo $result;
?>

resulting in an error:
Warning: file_get_contents( https://app.frontpad.ru/api/index.php?new_order): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /home/u93316/mySite/test.ru/rvr.php on line 13
I would be grateful for your help)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question