php - CURL keeping session with get and post -


i have logged in website post , it's ok. when site method ok (returend "hello, username !" etc) when i'am trying send post site it's redirecting me login page. it's seems curl doesnt send cookie session post method. how fix ? code:

public function curlinit() {     $this->_ch = null;     $this->_ch = curl_init();     curl_setopt($this->_ch, curlopt_useragent, $this->_useragent);     curl_setopt($this->_ch, curlopt_returntransfer, 1);     curl_setopt($this->_ch, curlopt_connecttimeout, 25);     curl_setopt($this->_ch, curlopt_verbose, 1);     curl_setopt($this->_ch, curlopt_cookiefile, dirname(__file__) . '/cookies-jar.txt');     curl_setopt($this->_ch, curlopt_cookiejar, dirname(__file__) . '/cookies-jar.txt');     curl_setopt($this->_ch, curlopt_followlocation, 1);     curl_setopt($this->_ch, curlopt_cookiesession, 1);     curl_setopt($this->_ch, curlopt_httpheader, 1);     curl_setopt($this->_ch, curlopt_autoreferer,  1);     if ($this->proxy)     {         curl_setopt ($this->_ch, curlopt_proxy, $this->proxy);     } } public function getpostsite($url, $data) {     $this->curlerror = false;      curl_setopt($this->_ch,curlopt_url, $url);     curl_setopt($this->_ch,curlopt_post, 1);     curl_setopt($this->_ch,curlopt_postfields, $data);     $result = curl_exec($this->_ch);     if (curl_errno($this->_ch))     {         $this->curlerror = curl_errno($this->_ch);         return false;     }     return $result; } public function  getgetsite($url) {     curl_setopt($this->_ch,curlopt_post, 0);     curl_setopt($this->_ch, curlopt_url, $url);     $data = curl_exec($this->_ch);     return $data; }  


Comments

Popular posts from this blog

Java sticky instances of class com.mysql.jdbc.Field aggregating -