Welcome Guest, Not a member yet? Register   Sign In
how to use form_validation validation post data
#1

post data to CI url,the post function below.
I sure url receive post data(log to file),but use form_validation validation args is invalid
PHP Code:
   private function http_post_data($url$data_string$authorization null) {

 
       $_ch curl_init();
 
       curl_setopt($_chCURLOPT_POST1);
 
       curl_setopt($_chCURLOPT_URL$url);
 
       curl_setopt($_chCURLOPT_POSTFIELDS$data_string);
 
       curl_setopt($_chCURLOPT_HTTPHEADER, array(
 
           'Content-Type: application/json; charset=utf-8',
 
           'Content-Length: ' strlen($data_string),
 
           'Authorization:' $authorization
                
)
 
       );
 
       ob_start();
 
       curl_exec($_ch);
 
       $return_content ob_get_contents();

 
       ob_end_clean();

 
       return $return_content;
 
   }

 
   public function post($url$data) {
 
       $_data_string json_encode($data);
 
       $_ret $this->http_post_data($url$_data_string);

 
       return json_decode($_ret);
 
   
Reply


Messages In This Thread
how to use form_validation validation post data - by qq8554650 - 11-15-2016, 01:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB