lostnucleus Posted February 23, 2009 Share Posted February 23, 2009 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 !! Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/ Share on other sites More sharing options...
rhodesa Posted February 23, 2009 Share Posted February 23, 2009 http://us.php.net/manual/en/function.rawurlencode.php Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/#findComment-769257 Share on other sites More sharing options...
lostnucleus Posted February 23, 2009 Author Share Posted February 23, 2009 i encoded the full url with it and nw geting "" empty string from the webpage ?? Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/#findComment-769295 Share on other sites More sharing options...
kenrbnsn Posted February 23, 2009 Share Posted February 23, 2009 Please show us the code you're now using. Ken Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/#findComment-769300 Share on other sites More sharing options...
premiso Posted February 23, 2009 Share Posted February 23, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/#findComment-769303 Share on other sites More sharing options...
sloth456 Posted February 23, 2009 Share Posted February 23, 2009 where ever there's a space use %20, that should do the trick, hopefully. Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/#findComment-769307 Share on other sites More sharing options...
rhodesa Posted February 23, 2009 Share Posted February 23, 2009 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'); Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/#findComment-769336 Share on other sites More sharing options...
Maq Posted February 23, 2009 Share Posted February 23, 2009 where ever there's a space use %20, that should do the trick, hopefully. That's what urlencode does, along with all the other necessary replacements. Quote Link to comment https://forums.phpfreaks.com/topic/146525-curl-empty-spaces-in-url-problem/#findComment-769355 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.