Posts Tagged with encode

Displaying 1-2 of 2 results.
Resolved: PHP Curl with login password create empty cookie and can't login to account
posted by admin on August 2, 2017

function bin_write($file, $str, $mode = 'w'){
$fd = fopen($file, $mode);
$result = fwrite($fd, $str);
fclose($fd);
chmod($file, 0777);
return $result;
}

function mycurlFunction($login, $password){
$user_agent = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1';

$cookies = dirname(__FILE__) . '/cookie/cookie_'.md5($login).'.txt';

if(!file_exists($cookies))
bin_write($cookies, '', 'w');

if (!is_writeable($cookies))
return "Cannot write to $cookies";

if ( ! extension_loaded('curl'))
return "You need to load/activate the curl extension.";

$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($ch, CURLOPT_ENCODING, "gzip");
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);

curl_setopt($ch, CURLOPT_POST, false);

$url = "there is your website url/auth?Password=$password&Login=$login";
curl_setopt($ch, CURLOPT_URL, $url);
$html = curl_exec($ch);
curl_close($ch);
return $html;
}

Curl create empty cookie 0B and not login to my account. How to resolve itRead more
Resolved: Yii 1.1 How to add html tag in CMenu menu item label text?
posted by admin on October 10, 2016
I have CMenu and I try to add html tags to menu items label and like this

<?php $this->widget('zii.widgets.CMenu',array(
'htmlOptions'=>array('class'=>'nav navbar-nav'),
'items'=>array(
array('label'=>'Главная', 'url'=>array('/')),
array('label'=>'Склады <span class="caret"></span>', 'url'=>array('#'),
'itemOptions'=>array('class'=>'dropdown'),
'linkOptions'=> array(
'class' => 'dropdown-toggle',
'data-toggle' => 'dropdown',
),
...
),
)); ?>

Output show encoded html with html character:

Склады <span class="caret"></span>
Read more