php - CURL did not returns any thing if the URL contains Special charters -
I want to get details from the URL while working fine for the normal character url but ami in one of the URLs Special characters like ' ³³ ' include My URL sample is as follows: My php code is: Try with the following (taken from):
http://www.abc.com/aóvek -xyz-pqr / 1/8 /
$ ch = curl_init ($ my_url); curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ CH, CURLOPT_BINARYTRANSFER, true); $ Content = curl_exec ($ ch);
$ encoded_url = preg_replace_callback ('#: // ([^ /] +) / ([^?] +) #', Function ($ match) {return ': //'. $ Match [1] ('/', Array_map ('crudelecode', explosion ('/', $ match [2])));}, $ my_url); $ Ch = curl_init ($ encoded_ril); curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); Curl_setopt ($ CH, CURLOPT_BINARYTRANSFER, true); $ Content = curl_exec ($ ch);
Comments
Post a Comment