Help friends with the problem, there is a link created for the API request, but when sending a CURL incoming $ _GET request comes partially, the last parameter is the description

array(5) { ["sum"]=> string(32) "fgfdgfdgfdgfdgfdgfgfg" ["amount"]=> string(4) "0.01" ["cardType"]=> string(1) "1" ["currency"]=> string(3) "AZN" ["description"]=> string(5) "Order" } 

http: //site.loc/api/pay/? sum = 166c0be39285392a66c8b5482dcea7f9 & amount = 0.01 & cardType = 1 ¤cy = AZN & description = Order from bank&email=mail@gmail.com&errorUrl= http://site.com/error&key=dfgrhdpgdhhhhhhhhhfg/hhhhhhhhhhfg.hd/htfg/hp/hp/hl/html/gmail.com&errorUrl= 063000000 & successUrl = http: //site.com/zakaz-otpravlen/ "

that is, there is something here with description spaces, can someone tell me what the problem is with CURL?

 $ch = curl_init($url); //curl_setopt($ch, CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.0; MyIE2; .NET CLR 1.1.4322)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); $content = curl_exec($ch); curl_close($ch); return $content; 
  • one
    In the address, the space should be written as %20 . Use the urlencode function to encode parameters - Nick
  • How to use the function correctly, or rather I have already tried to use it in the example, but the gett request also comes cropped from me? $ ch = curl_init (urldecode ($ url)); - Eugene Kolesnik
  • thanks figured out - Eugene Kolesnik

1 answer 1

to write parameters I used the function urlencode ()

  • 2
    Give an example of the code that you got - and then without it, other participants think that this is a clarification to the question, not the answer. - PashaPash