php - cURL+redirect with cookie -



php - cURL+redirect with cookie -

how can redirect user web site cookie? im using code

<?php $fields_string = 'client_login=jadro&client_pass=jadro&client_remember=on&action=client_login'; $options = array( curlopt_returntransfer => true, curlopt_header => true, curlopt_followlocation => true, curlopt_useragent => "mozilla/5.0 (windows; u; windows nt 6.1; ru; rv:1.9.1.7) gecko/20091221 firefox/3.5.7 firephp/0.3", curlopt_autoreferer => false, curlopt_connecttimeout => 120, curlopt_timeout => 120, curlopt_maxredirs => 10, ); $ch = curl_init(); curl_setopt_array( $ch, $options ); curl_setopt($ch,curlopt_url,'http://orion10.ru'); //curl_setopt($ch,curlopt_post,count(explode('&',$fields))); curl_setopt($ch,curlopt_postfields,$fields_string); //curl_setopt($ch,curlopt_cookiejar, 'cooc.txt'); //curl_setopt($ch,curlopt_cookiefile, 'cooc.txt'); curl_setopt($ch, curlopt_cookiejar, getcwd()."/cookies.txt"); curl_setopt($ch, curlopt_cookiefile, getcwd()."/cookies.txt"); $result = curl_exec($ch); echo $result; //header("location: http://orion10.ru".session_name().'='.session_id()); header('refresh: 15; url='.$url['http://orion10.ru']); exit(); ?>

i need authorize user site.

curl beingness executed on your server. therefore, website in question thinks server user. i.e. when redirect actual user website in question, won't recognize them. read this.

php cookies curl

Comments

Popular posts from this blog

ruby on rails - Devise Logout Error in RoR -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

model view controller - MVC Rails Planning -