L
L
lexstile2018-04-17 23:10:37
PHP
lexstile, 2018-04-17 23:10:37

What am I doing wrong in the curl request?

I make a request:

$host = API_URL_USER_MEDIA;
    $parameters = array(
    'access_token'=>ACCESS_TOKEN,
    'count'=>2
    );
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $host);
    curl_setopt($ch, CURLOPT_POST,true); 
    curl_setopt($ch, CURLOPT_POSTFIELDS,$parameters); 
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_TIMEOUT, 90);		
        $jsonData = json_decode(curl_exec($ch));
        print_r($jsonData);

Returns empty.
What did I do wrong?
I send a request to https://api.instagram.com/v1/users/self/media/rece... ...
Everything works correctly via file_get_contents().

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman PHP, 2018-04-17
@lexstile

but who knows) you need to look at what curl_exec returns, and if it is false, curl_error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question