there is a file, its name contain empty space. ex) hello I am good.zip
I am trying to read the file using curl.
so, the url should be like this:
http://domain.com/hello I am good.zip
but, curl can not seems to read that kind of file names. because url is not right format.
So, Is there another way to read the file using curl? Or some options that I didn't know?
server lang is php. and my curl code is below:
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
$url = str_replace(" ","%20",$url); // to properly format the url
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With