Skip to content

ACurl::post(),put() signature differs from get(),delete(),head() #3

@dmtrs

Description

@dmtrs

Currently the definition of post & put methond in ACurl is different from the get, delete & head. I consider that this function should have consistent signatures. Get, delete, and head are missing the $data.
If the $data was added, to have consistent signature, it is expected that the data params will be appended to the url provided but does this need more special handling than http_build_query($data)?
Example:

<?php
$c=new ACurl();
$c->get('http://api.someservice.com',array('user'=>1),true);
var_dump($c->options->url);

Is this result to http://api.someservice.com/user/1 or http://api.someservice.com?user=1 ? Thing is that if we want the ACurl to handle the above url construction it need to have a $urlFormat property to accept 2 consts 'path' or 'get', similar to the CUrlManager

Bad think is that even the CUrlManager has the functionality for creating path or get urls id does not provide a method for out of the application urls and even if he did it would be useless as the url format of your yii application may differ from the url format you want to fetch data from.
On the other hand url format seems to be an irrelevant property for a curl object to some people. Please let me know what do you think about it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions