回显变量有效,但不能放入文件?

I have a variable called $filter. If I run echo $filter; I get the contents of it. However, If I run

file_put_contents("/nrj/vvr/tmp/lol", $filter);

I do get the file, but the contents is just 1. It should contain alot of different things. I use the exact same syntax usually, and it works. I get no error messages.

This line was the problem

$filter = curl_exec($ch);

For some reason, it ignores the first things and just executes it without setting any variable. Under this I had

echo $filter;

Giving me the impression that it was that line that output it, but it was the one above.