I am trying to use cURL in a plugin but it doesn't seem to work. code: PHP: $plugin = $args[0]; $sender->sendMessage($args[0]); set_time_limit(0); $url = "https://pmpm-hittmana.c9users.io/plugins/download/$plugin.zip"; $sender->sendMessage($url); //This is the file where we save the information $fp = fopen ("$plugin.zip", 'w+'); $sender->sendMessage(dirname("../$plugin.zip")); //Here is the file we are downloading, replace spaces with %20 $ch = curl_init(str_replace(" ","%20",$url)); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_FILE, $fp); // get curl response curl_exec($ch); curl_close($ch); fclose($fp); $args[0] is ArmorSpawn and I have confirmed that I can download it both on a browser and if I run the above code modified for native php. The problem is that it does not write anything to the file that is created. The file is there but it is 0 bytes. Why does my cURL request not work?
remove set time limit, NOTE c9 web server don't run forever unless you have that some plan the free plan server shuts off after some time maybe try ../$plugin and some times you have to hack it to make download work since it is dependent on server
and how do you think that is dangerous? unless you do eval or system or exec everything you get there no harm just like web browser with js disabled loading a webpage
I only meant that all (or most) platforms should be able to use it. Therefore I meant a plugin won't break because it uses cURL
cURL is part of standard PHP extensions, bundled with default PHP downloads on Windows, i.e. it is an official extension (implying that it is better than YAML or pthreads which aren't bundled with default PHP downloads). If individual systems like PHP for Android don't work with them, it is their problems.