Welcome Guest, Not a member yet? Register   Sign In
CURL Request Class - urlencode
#3

(08-17-2024, 06:58 PM)kenjis Wrote:
(08-17-2024, 09:58 AM)68thorby68 Wrote: Is there a way to instruct the CURL Request Class not to encode the url? 

No.

Use `query` option to send a request with query string.
https://codeigniter.com/user_guide/libra...html#query


Many thanks kenjis, with logging, my request is now and works perfectly, Thank you
My code new reads:
PHP Code:
$update_row $client->request('GET','/THIRDPARTY/',
 [
    'debug' => WRITEPATH.'curl_logs/curl_log.txt',
    'query' => [
        'user_field_names' => 'true'
        'filter__Company Name__equal' => my company (sports department)

     ], 
    'headers' => [
        'Content-Type' => 'application/json',
        'Authorization' => [mytoken]
    ],
    'json' => [
    
]); 
from the logs, this outputs
Code:
GET /THIRDPARTY/?user_field_names=true&filter__Company+Name__equal=my+company+%28sports+department%29


Just to note, when I use the format
PHP Code:
$update_row $client->get('/THIRDPARTY/?user_field_names=true&filter__Company Name__equal=my company (sports department), 
The CURL Request Class edits the url to
Code:
GET /THIRDPARTY/?user_field_names=true&filter__Company_Name__equal=my+company+%28sports+department%29
The issue being the space between Company and Name in parameter filter__Company Name__equal is being replaced with an underscore rather and plus!!!

Again many thanks.
Reply


Messages In This Thread
CURL Request Class - urlencode - by 68thorby68 - 08-17-2024, 09:58 AM
RE: CURL Request Class - urlencode - by kenjis - 08-17-2024, 06:58 PM
RE: CURL Request Class - urlencode - by 68thorby68 - 08-18-2024, 02:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB