extension for Yii, Yii2 framework
- php 5.4+
- GET
- POST
- PUT
- DELETE
- HEAD
- setOption
- unsetOption
- getOption
- setParams
- string response or array response
- responseCode
@params
- string $url //the url you want to post
- boolean $raw //If $raw is true, you can get a response string directly. Else you can get an array encode by response json. @return
- boolean $flag //the $flag shows your post request is succeed or failed.
public function testPost(){
$url = 'http://www.baidu.com';
$curl = new Curl;
if($curl -> POST($url)){
print_r($curl->response);
}else{
echo $curl->responseCode;
}
}