XF 2.1 API, download an attachment

Robert9

Well-known member
External php:


Code:
    $url = '/api/attachments/123/data';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_URL, $url);
    $data = curl_exec($ch);

Funny, funny, the raw data is shown on my screen;
how can i save the data instead to a file, please?

Why it is shown at all without any echo, print_r?
 
Top