Welcome Guest, Not a member yet? Register   Sign In
ci4 curl
#1

(This post was last modified: 02-15-2023, 06:06 AM by devo.)

PHP Code:
how to insert curlopt_ipresolve to curl libary codeigniter

$ch 
curl_init();
 
curl_setopt($chCURLOPT_IPRESOLVECURL_IPRESOLVE_V4); 
Reply
#2

PHP Code:
<?php

$options 
= [
    'baseURI' => 'http://example.com/api/v1/',
    'timeout' => 3,
];
$client = \Config\Services::curlrequest($options); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 05-19-2023, 03:57 AM by SubrataJ.)

(02-16-2023, 12:05 AM)InsiteFX Wrote:
PHP Code:
<?php

$options 
= [
    'baseURI' => 'http://example.com/api/v1/',
    'timeout' => 3,
];
$client = \Config\Services::curlrequest($options); 

@InsiteFX Hello sir could you please help me understand how I should send this data using curlRequest, I am having a hard time achieving this.

API call that I want to make
PHP Code:
curl https://api.dropbox.com/oauth2/token \
    -d code=<AUTHORIZATION_CODE> \
    -d grant_type=authorization_code \
    -d redirect_uri=<REDIRECT_URI> \
    -d client_id=<APP_KEY> \
    -d client_secret=<APP_SECRET

I have tried this way but had no success at all
PHP Code:
$body = [
 
'code' => getenv('dropbox.authorization_code'),
 
'grant_type' => 'authorization_code',
 
'redirect_uri' => getenv('dropbox.redirect_uri'),
 
'client_id' => getenv('dropbox.client_id'),
 
'client_secret' => getenv('dropbox.client_secret'),
 ];


 
$res =  $this->client->setBody(json_encode($body))->post('https://content.dropboxapi.com/oauth2/token', [
 
'headers' => [
 
'Content-Type'    => 'application/json',
 
'Accept'    => 'application/json',
 ],
 ]);
 echo 
$response->getBody(); 
Learning Codeigniter 
Reply
#4

stackoverflow -> Php Curl adding Params
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(This post was last modified: 07-04-2023, 06:10 AM by devo.)

hii how to add curl option in curlrequest class codeigniter 4


i try like this but it not working

PHP Code:
$options = [
    'CURLOPT_IPRESOLVE' => CURL_IPRESOLVE_V4
];
$client = \Config\Services::curlrequest($options); 
Reply
#6

All options are documented.
https://codeigniter4.github.io/CodeIgnit...t.html#id7

You need to customize CURLRequest if you need to set options that are not supported now.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB