Posts Tagged with url

Displaying 1-10 of 15 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: Yii2 showScriptName remove index.php Not Found apache
posted by admin on June 2, 2017
I tried to remove index.php from url by many ways, but without results.
My OS is Ubuntu Linux.
Server Apache.
In web.php in config directory

<?php
$config = [
'components' => [
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'/' => 'site/index',
'login' => 'site/login',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
],
],
]
]

Still not working
I try to created .htaccess in web direcory

RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

Still without result
In result
404 Not Found

Not Found

The requested URL /login was not found on this server.

Apache/2.4.18 (Ubuntu) Server at tracker.dev Port 80

Please help me to resolve problemRead more
Resolved: Yii2 slash 2f url problem
posted by admin on February 6, 2017
After installation Yii2, I try to navigate with pages of application, and in url I have problem with slashes

http://website.dev/index.php?r=site%2Fabout
http://website.dev/index.php?r=site%2Fcontact
http://website.dev/index.php?r=site%2Floginite%2Floginite%2Flogin

I want to slashes in url in place of %2FRead more
Resolved: Yii 1.1 Redirect to referrer url
posted by admin on November 10, 2016
I want to redirect from referrer page
Now:

$this->redirect(array('admin'));

I want something like

$this->redirect({referrer});
Read more
Resolved: Yii 1.1 Cmenu item url array working by wrong logic
posted by admin on October 11, 2016
Cmenu item url working not correct.
It take my current url and the compose new url, and it is wrong.
For example it looks like like this

http://bukivedi.store/index.php?r=stores/stores/user

But I have only module Stores and want to view result:

http://bukivedi.store/index.php?r=stores/user

My Cmenu array is here:

array('label'=>'Таблицы <span class="caret"></span>', 'url'=>array('#'),
'itemOptions'=>array('class'=>'dropdown'),
'linkOptions'=> array(
'class' => 'dropdown-toggle',
'data-toggle' => 'dropdown',
),
'items' => array(
array('label' => 'Пользователи', 'url' => array('stores/user')),
array('label' => '', 'url' => array('#'), 'itemOptions'=>array('role'=>'separator', 'class'=>'divider')),
),
),
Read more
Resolved: Yii CGridView pagination not working and alert 500 or 404 error
posted by admin on April 23, 2016
I have trouble about cgridview pagination.
I am using admin page(/{module}/admin that) generated by gii.
it has search form and grid with pagination. its work well without urlmanager

but my team have create urlmanager rule long ago.

'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

'<module:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>'=>'<module>/<controller>/<action>',

),
),


when I use admin page with this urlmanager rule. It has some problem.
- if not using grid sort or pagination. I can filter in grid and form.
- but if using sort or pagination. I can not filtering in grid and form anymore.

page link is wierd and i think because of some attribute(params) are null like this

/{module}/{controller}/admin/BookManageMain%5Bbmm_code%5D//BookManageMain%5Bbmm_tid%5D/2/.../BookManageMain_page/2/ajax/book-manage-main-grid

if I am copy this url to another tab and Its can not filtering in grid and form too.
but if I remove attribute that has null value(BookManageMain%5Bbmm_code%5D//) I can filter grid and form.

/{module}/{controller}/admin/BookManageMain%5Bbmm_tid%5D/2/.../BookManageMain_page/2/ajax/book-manage-main-grid

console log (not sure filter use POST and sort/page use GET)

before click pagerlink or sorting
.../{controller}/action?BookManageMain%5Bbmm_code%5D=&BookManageMain%5Bbmm_tid%5D=2&...&BookManageMain_page=1&ajax=book-manage-main-grid

after click

.../{controller}/action/BookManageMain%5Bbmm_code%5D//BookManageMain%5Bbmm_tid%5D/2/.../BookManageMain_page/2/ajax/book-manage-main-grid
Read more
Resolved: Yii get last parameter from current url without GET name getQuery
posted by admin on April 10, 2016
My controller

public function actionVideo()
{
//want to get last url parametr
}


My URL like

...video/12313213123/dubaivideos


I want to get dubaivideosRead more
Resolved: How do I get a YouTube video thumbnail from URL or embed iframe
posted by admin on April 9, 2016
If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?Read more
Resolved: Google.com redirect to my location google
posted by admin on April 9, 2016
Google.com redirect to another google, google in my location
For example
google.am
or
google.ru
etc...

I want too open google.com without redirectRead more
Resolved: Yii 1.1 Errors not working, throw only yii exeption
posted by admin on April 7, 2016
I got this Yii error on my CRUD UPDATE by $id

The requested page does not exist.


Error line

public function loadModel($id)
{
$model=Media::model()->findByPk((int)$id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');//error line
return $model;
}
Read more