Arens Myzyri Arens Myzyri - 9 months ago 47
PHP Question

How to use a curl GET call code inside php

I have this code give from a platform called wrike.

curl -g -X GET -H 'Authorization: bearer <token_here>'

My question is, how to turn this code into php? When executed the response from strike is in json. I don't need to know how to fetch the response. (already have created the code for it.)
I just want to know how to use this code inside a php file.


try this: (// Generated by curl-to-PHP:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "[\"metadata\",\"attachmentCount\",\"parentIds\",\"sharedIds\",\"superParentIds\",\"description\",\"briefDescription\",\"hasAttachments\",\"responsibleIds\",\"recurrent\",\"superTaskIds\",\"subTaskIds\",\"customFields\",\"authorIds\",\"dependencyIds\"]");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");

$headers = array();
$headers[] = "Authorization: bearer <token_here>";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
curl_close ($ch);