Jump to content

Curl empty spaces in url problem ??


lostnucleus

Recommended Posts

I have a url  such has

"http://google.com/this is a space here/and its a problem/music song.mp3 "

 

when i use it with curl to download such webpages using

curl_setopt($s,CURLOPT_URL,"http://google.com/this is a space here/and its a problem/music song.mp3 ");

 

I get some other page which is not i want but using my browser (opera) i get wat i want with the same url ??

 

Thanks In Advance :) !!

 

 

Link to comment
https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/
Share on other sites

EDIT:

 

Post the actual url not some http:// this is a weird site url that i cannot just write http://www.site.com/file.mp3

 

That will get you more help than anything.

 

My bet is your are urlencoding the whole url, you should only do this for the name of that file without the extension. http://www.google.com/(your file name needs to be encoded).mp3

 

actually...you probably need this OPT:

curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);

 

another note...rawurlencode() is for the parts, not the whole string:

$url = 'http://google.com/'.rawurlencode('this is a space here').'/'.rawurlencode('and its a problem').'/'.rawurlencode('music song.mp3');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.