linslin / Yii2-Curl

:curly_loop: Yii2 Curl extension based on PHP cURL.
178 stars 92 forks source link

fields[email] #60

Closed mydesign closed 7 years ago

mydesign commented 7 years ago

Can i set params like? 'fields[email]' => $model->email,

linslin commented 7 years ago

What you try to achieve? Do you want to set a get- or post- or header param?

mydesign commented 7 years ago

i try get

linslin commented 7 years ago

Have you tried:

// GET request with GET params
// http://example.com/?key=value&scondKey=secondValue
$curl = new curl\Curl();
$response = $curl->setGetParams([
        'email' => $model-email
     ])
     ->get('http://example.com/');
mydesign commented 7 years ago

This API need fields[email], from long url: https://api.unisender.com/ru/api/subscribe?format=json&api_key=KEY&list_ids=134,135&fields[email]=test@example.org&tags=MyTag1,MyTag2&request_ip=12.34.56.78&request_time=2011-01-01&double_optin=0&confirm_ip=34.56.78.90&confirm_time=2011-01-02&overwrite=0

This is not error, but it be feature

linslin commented 7 years ago
// GET request with GET params
// http://example.com/?key=value&scondKey=secondValue
$curl = new curl\Curl();
$response = $curl->setGetParams([
        'fields[email]' => $model-email
     ])
     ->get('http://example.com/');