Форум программистов, компьютерный форум, киберфорум
PHP
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.67/9: Рейтинг темы: голосов - 9, средняя оценка - 4.67
0 / 0 / 0
Регистрация: 18.05.2017
Сообщений: 13

Как передать URL страницы с параметрами action=?

18.05.2017, 19:32. Показов 1845. Ответов 4
Метки php (Все метки)

Студворк — интернет-сервис помощи студентам
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/**
 * [PHPFOX_HEADER]
 */
 
defined('PHPFOX') or exit('NO DICE!');
 
class Phpfox_Gateway_Api_belentlik implements Phpfox_Gateway_Interface
{
    /**
     * Holds an ARRAY of settings to pass to the form
     *
     * @var array
     */
    private $_aParam = array();
 
    /**
     * Holds an ARRAY of supported currencies for this payment gateway
     *
     * @var array
     */
    private $_aCurrency = array('USD');
 
    /**
     * Class constructor
     *
     */
    public function __construct()
    {
 
    }   
 
    /**
     * Set the settings to be used with this class and prepare them so they are in an array
     *
     * @param array $aSetting ARRAY of settings to prepare
     */
    public function set($aSetting)
    {
        $this->_aParam = $aSetting;
 
        if (Phpfox::getLib('parse.format')->isSerialized($aSetting['setting']))
        {
            $this->_aParam['setting'] = unserialize($aSetting['setting']);
        }
    }
 
    /**
     * Each gateway has a unique list of params that must be passed with the HTML form when posting it
     * to their site. This method creates that set of custom fields.
     *
     * @return array ARRAY of all the custom params
     */
    public function getEditForm()
    {       
        return array(
            'apiKey' => array(
                'phrase' => Phpfox::getPhrase('apiKey'),
                'phrase_info' => Phpfox::getPhrase('apiKey_info'),
                'value' => (isset($this->_aParam['setting']['apiKey']) ? $this->_aParam['setting']['apiKey'] : '')
            ),
            'merchantAccountCode' => array(
                'phrase' => Phpfox::getPhrase('merchantAccountCode'),
                'phrase_info' => Phpfox::getPhrase('merchantAccountCode_info'),
                'value' => (isset($this->_aParam['setting']['merchantAccountCode']) ? $this->_aParam['setting']['merchantAccountCode'] : '')
            )
        );
    }
 
    /**
     * Returns the actual HTML <form> used to post information to the 3rd party gateway when purchasing
     * an item using this specific payment gateway
     *
     * @return bool FALSE if we can't use this payment gateway to purchase this item or ARRAY if we have successfully created a form
     */
 
    public function getForm()
    {       
        $bCurrencySupported = true;
 
        if (!in_array($this->_aParam['currency_code'], $this->_aCurrency))
        {
            if (!empty($this->_aParam['alternative_cost']))
            {
                $aCosts = unserialize($this->_aParam['alternative_cost']);
                foreach ($aCosts as $aCost)
                {
                    $sCode = key($aCost);
                    $iPrice = $aCost[key($aCost)];
 
                    if (in_array($sCode, $this->_aCurrency))
                    {
                        $this->_aParam['amount'] = $iPrice;
                        $this->_aParam['currency_code'] = $sCode;
                        $bCurrencySupported = false;
                        break;
                    }
                }
 
                if ($bCurrencySupported === true)
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }   
        $aParts = explode('|', $this->_aParam['item_number']);
        $aForm = array(
            'url' => 'https://lk.belentlik.tm/gates/signature?', 
            'param' => array(
                'requestType' => 'Sale',
                'merchantAccountCode' => $this->_aParam['setting']['merchantAccountCode'],
                'transactionIndustryType' => 'EC',
                'accountType' => 'R',
                'accountNumber' => '4111111111111111',
                'accountAccessory' => '0422',
                'CVV2' => '123',
                'amount' => '10',
                                'currency' => $this->_aParam['currency_code'],
                'lang' => 'RU',
                'item Code' => '999999',
                'transactionCode' => '0000000001',
                'customerAccountCode' => '1818',
                'ticketNumber' => $this->_aParam['item_number'],
                'memo' => 'xyz',
                'itemCount' => '2',
                'items' => '',
                'holderType' => 'P',
                'holderName' => 'MARS+SNIKERS',
                'holderBirthdate' => '',
                'countryCode' => 'US',  
                                'state'=>'',
                                'street'=>'',
                            'city'=>'',
                            'zipCode'=>'',
                            'phone'=>'',
                            'email'=>'',
                            'apiKey' => $this->_aParam['setting']['apiKey']
 
            )
        );  
 
        'header'  => "Location:  https://lk.belentlik.tm/gates/paypage?action=",
 
        if ($this->_aParam['is_test'])
        {
            $aForm['param']['demo'] = 'Y';
        }
        return $aForm;
 
    }
 
    /**
     * Performs the callback routine when the 3rd party payment gateway sends back a request to the server,
     * which we must then back and verify that it is a valid request. This then connects to a specific module
     * based on the information passed when posting the form to the server.
     *
     */
    public function callback()
    {
При первом запросе мы получаем responseType=signature&responseMessage=A pproved&responseCode*​=A01&action=0HQcy. ..*​........ Теперь нам нужно передать всё это на lk.belentlik.tm/gates/paypage?action=

Добавлено через 5 часов 53 минуты
Кто нибудь знает как передать полученные данные в header('Location: .......... ?
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
18.05.2017, 19:32
Ответы с готовыми решениями:

Как скрыть параметры URL и передать их методом пост используя Url.Action()
Здравствуйте. У меня в представлении на сайте есть ссылка, которая формируется в методе действии контроллера MyView1 с помощью...

Как получить параметр с url в другом Action-е?
Екшн actionRemind отправляет письмо юзеру с ссылкой(на екшн actionRecovery) в которой содержится параметр &quot;имейл&quot; ...

OpenGraph facebook. Считаются ли по версии facebook страницы с разными параметрами url дублями?
Настроил og-теги на страницы с новостями. У меня адрес выглядит так: сайт/news/?ELEMENT_ID=100500 На каждой такой странице свои og-теги....

4
Эксперт PHP
5755 / 4134 / 1508
Регистрация: 06.01.2011
Сообщений: 11,276
19.05.2017, 19:36
Просто кодируйте сформированный URL с помощью urlencode и подставляйте в action.
0
0 / 0 / 0
Регистрация: 18.05.2017
Сообщений: 13
20.05.2017, 20:19  [ТС]
Спасибо за ответ! Но можно подробнее, к примеру как? Я пробовал прописать так
PHP
1
2
3
4
5
6
7
8
9
    $options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded",
        'method'  => 'POST',
        'content' => http_build_query($data),
         ),
    );
    $context  = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
Или вот так
PHP
1
2
3
$response = file_get_contents('https://lk.belentlik.tm/gates/signature');
parse_str($response, $arr);
header('Location: https://:lk.belentlik.tm/gates/paypage?action='.$arr['action']);
Но никак не хочет просто даже перейти на второй урл
0
Эксперт PHP
5755 / 4134 / 1508
Регистрация: 06.01.2011
Сообщений: 11,276
21.05.2017, 06:20
Что содержится в $arr['action']? И почему Вы не задействовали urlencode, если там URI? И ещё: header может вообще не устанавливать заголовок, если до него идёт вывод данных.
0
0 / 0 / 0
Регистрация: 18.05.2017
Сообщений: 13
22.05.2017, 10:24  [ТС]
Честно говоря я не знаю пока как дальше прописать

Добавлено через 3 часа 11 минут
В $arr['action'] должно быть всё, что после &action=
PHP
1
responseType=signature&responseMessage=Approved&responseCode=A01&action=0HQcy8ygi5Uiql8dQp65%2B6iqdMGr9ogWN6uLddQxtIUpfOkMYbjfqIxNJXUDf6lTSAZ8gbrMXVzM%0D%0A%2FPhYoL7RLBnI%2F5QSH%2B0hn8WOMrjdF%2Bp%2FywQX2GDjH09YMxrBipw1%2FxyzVJ8R0LWhI4ItyxZK21mo%0D%0AL%2BEJouxNCvMCMzO1MJTlhICDMHx7I1jIMZcEIJngXDqgHPJmPrWerCLBPQ14KhBeSg4og7Y4PYo8%0D%0AYbyLYadiFMPk6n0RSTEoUgGKbUsyKnJ6WpRjvW8D3pjjeyiA95m7A%2B%2FaJn5Lw7tjusQllkNScTlK%0D%0ADBBPN8lR7iDYyDjZv2xtOur0255PPNIdB4c0%2F1RQu7YqG1Yh63AZzUEQWa9LvkOHMCfGTaD69P4C%0D%0ApigzmG7YY5lKZW2tMZAAueWxeapPME2%2BSLW%2BbDbK1E4I4tLW83Uu10Fs3Tz1W8RSdyk%2FVaeym8lu%0D%0Aw1g2hZMCWigz3fMFDR1kxNfa3wzfstqp7uRhkhsTnJhFpVQ4mTsX%2BYQyMCS%2BlNqMN01kqBejE3lK%0D%0Ajq%2FnOJRfg5k1YGvfg7%2Bncn%2BE9CDARQu4FBOahMkYobm6LTUwwh%2B%2BQ4AVXwMt999Ackfptov2eP93%0D%0AfPRI97eIZ8vGK0f7OK9tacl%2BbRHOwFlYT8N8H6kbNFNoUtz9e1UyO9yhW962gqbdfK%2FW9s5yK0Pg%0D%0ACe0Zqvo%2FOg0uC6rAGmtU%2FIspZOzLyfJf3o8QdJpzcnhXpgu9MbDLaT9dXywZGFFXb8PpyiBs02c6%0D%0A6eDUtkhDUhRSqAARHn6sTQiiX11wng%3D%3D%0D%0A
Добавлено через 6 минут
Т.е мы посылаем сначало Requestè
PHP
1
https://lk.belentlik.tm/gates/signature?requestType=sale￾auth&merchantAccountCode=300001&transactionIndustryType=EC&accountType=R&amount=5400&currency=USD&
Получаем
PHP
1
2
3
4
5
responseType=signature&responseMessage=Approved&responseCode=A01&action=9dbE1Y2rEXFZTSci%2FZTZLKDNDz1AcDVJxDqC
DkPkdldaLtP09flBLGUh0Hh8vmBU%2FG6OKGJ1JzpH%0D%0AUaF2GSgKnXkuBGMMEgPqbPq%2BupWNr%2FZ8GA%2FOSOua9niCA
4IvZ17AWLgzt440USJg7Cp75L2Fqe5H%0D%0AAyLlPWcQWU0nIv2U2Sw1fUs5zVscg5EG3%2Fo%2BDVSq70GdB3%2BIy%2Bti1OzeCF
rai%2FWWaLsRJoFd%2Bt5q%0D%0ATsLL750h%2B0SEEoqfG88usVjC6LBrhpyIMANF3i%2FfbNX%2Fp73a1NVn%2Buz7hoFdnvGOb2i
8ryyuLs%2Fa%0D%0A4K6IjGcaScudkRymnFm
теперь передаем
PHP
1
https://lk.belentlik.tm/gates/paypage?action=<from1stresponse>
Добавлено через 17 часов 42 минуты
Так тоже не получается
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
/**
 * [PHPFOX_HEADER]
 */
 
defined('PHPFOX') or exit('NO DICE!');
 
class Phpfox_Gateway_Api_belentlik implements Phpfox_Gateway_Interface
{
    /**
     * Holds an ARRAY of settings to pass to the form
     *
     * @var array
     */
    private $_aParam = array();
   
    /**
     * Holds an ARRAY of supported currencies for this payment gateway
     *
     * @var array
     */
    private $_aCurrency = array('USD');
   
    /**
     * Class constructor
     *
     */
    public function __construct()
    {
       
    }  
   
    /**
     * Set the settings to be used with this class and prepare them so they are in an array
     *
     * @param array $aSetting ARRAY of settings to prepare
     */
    public function set($aSetting)
    {
        $this->_aParam = $aSetting;
       
        if (Phpfox::getLib('parse.format')->isSerialized($aSetting['setting']))
        {
            $this->_aParam['setting'] = unserialize($aSetting['setting']);
        }
    }
   
    /**
     * Each gateway has a unique list of params that must be passed with the HTML form when posting it
     * to their site. This method creates that set of custom fields.
     *
     * @return array ARRAY of all the custom params
     */
    public function getEditForm()
    {      
        return array(
            'apiKey' => array(
                'phrase' => Phpfox::getPhrase('apiKey'),
                'phrase_info' => Phpfox::getPhrase('apiKey_info'),
                'value' => (isset($this->_aParam['setting']['apiKey']) ? $this->_aParam['setting']['apiKey'] : '')
            ),
            'merchantAccountCode' => array(
                'phrase' => Phpfox::getPhrase('merchantAccountCode'),
                'phrase_info' => Phpfox::getPhrase('merchantAccountCode_info'),
                'value' => (isset($this->_aParam['setting']['merchantAccountCode']) ? $this->_aParam['setting']['merchantAccountCode'] : '')
            )
        );
    }
   
    /**
     * Returns the actual HTML <form> used to post information to the 3rd party gateway when purchasing
     * an item using this specific payment gateway
     *
     * @return bool FALSE if we can't use this payment gateway to purchase this item or ARRAY if we have successfully created a form
     */
     
    public function getForm()
    {      
 
        $bCurrencySupported = true;
               
        if (!in_array($this->_aParam['currency_code'], $this->_aCurrency))
        {
            if (!empty($this->_aParam['alternative_cost']))
            {
                $aCosts = unserialize($this->_aParam['alternative_cost']);
                foreach ($aCosts as $aCost)
                {
                    $sCode = key($aCost);
                    $iPrice = $aCost[key($aCost)];
                   
                    if (in_array($sCode, $this->_aCurrency))
                    {
                        $this->_aParam['amount'] = $iPrice;
                        $this->_aParam['currency_code'] = $sCode;
                        $bCurrencySupported = false;
                        break;
                    }
                }
               
                if ($bCurrencySupported === true)
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
 
            }
if( isset ($_GET['action'])) {
$response = file_get_contents('https://lk.belentlik.tm/gates/signature');
parse_str($response, $arr);
header('Location: https://lk.belentlik.tm/gates/paypage?action='.$arr['action']);
    }
        $aParts = explode('|', $this->_aParam['item_number']);
        $aForm = array(
            'url' => 'https://lk.belentlik.tm/gates/signature?',
            'param' => array(
                'requestType' => 'Sale',
                'merchantAccountCode' => $this->_aParam['setting']['merchantAccountCode'],
                'transactionIndustryType' => 'EC',
                'accountType' => 'R',
                'accountNumber' => '4111111111111111',
                'accountAccessory' => '0422',
                'CVV2' => '123',
                'amount' => '10',
                'currency' => $this->_aParam['currency_code'],
                'lang' => 'RU',
                'item Code' => '999999',
                'transactionCode' => '0000000001',
                'customerAccountCode' => '1818',
                'ticketNumber' => $this->_aParam['item_number'],
                'memo' => 'xyz',
                'itemCount' => '2',
                'items' => '',
                'holderType' => 'P',
                'holderName' => 'MARS+SNIKERS',
                'holderBirthdate' => '',
                'countryCode' => 'US', 
                                'state'=>'',
                                'street'=>'',
                            'city'=>'',
                            'zipCode'=>'',
                            'phone'=>'',
                            'email'=>'',
                            'apiKey' => $this->_aParam['setting']['apiKey'],
        ),
 
 
        ); 
 
 
        if ($this->_aParam['is_test'])
        {
            $aForm['param']['demo'] = 'Y';
 
        }
       
        return $aForm;
    }
 
    /**
     * Performs the callback routine when the 3rd party payment gateway sends back a request to the server,
     * which we must then back and verify that it is a valid request. This then connects to a specific module
     * based on the information passed when posting the form to the server.
     *
     */
    public function callback()
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
22.05.2017, 10:24
Помогаю со студенческими работами здесь

Как можно использовать action=url в form аналогично location.replace()
Помогите пожалуйста. Есть страничка на которой вводится логин и пароль, необходимо что бы при событии onclick передались логин и пароль -...

Как передать параметры в через @Html.Action
Можно ли это сделать и как?

Как передать скрипт через Action контроллера
Хочу передать скрипт, через метод контроллера в одном из параметров типо ViewBag.Script, т.к он генерируется в контроллере. ...

Как передать в form action (html) javascript переменную?
как передать в form action (html ) javascript переменную как ее там написать синтаксически правильно - например вот пример как...

Как закрыть в robots страницы action?
Всем доброго времени суток! Прошу перенести тему в нужный раздел, не нашел раздел для этой темы. Вопрос: как закрыть в роботсе...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
5
Ответ Создать тему
Новые блоги и статьи
Первый деплой
lagorue 16.01.2026
Не спеша развернул своё 1ое приложение в kubernetes. А дальше мне интересно создать 1фронтэнд приложения и 2 бэкэнд приложения развернуть 2 деплоя в кубере получится 2 сервиса и что-бы они. . .
Расчёт переходных процессов в цепи постоянного тока
igorrr37 16.01.2026
/ * Дана цепь постоянного тока с R, L, C, k(ключ), U, E, J. Программа составляет систему уравнений по 1 и 2 законам Кирхгофа, решает её и находит токи на L и напряжения на C в установ. режимах до и. . .
Восстановить юзерскрипты Greasemonkey из бэкапа браузера
damix 15.01.2026
Если восстановить из бэкапа профиль Firefox после переустановки винды, то список юзерскриптов в Greasemonkey будет пустым. Но восстановить их можно так. Для этого понадобится консольная утилита. . .
Изучаю kubernetes
lagorue 13.01.2026
А пригодятся-ли мне знания kubernetes в России?
Сукцессия микоризы: основная теория в виде двух уравнений.
anaschu 11.01.2026
https:/ / rutube. ru/ video/ 7a537f578d808e67a3c6fd818a44a5c4/
WordPad для Windows 11
Jel 10.01.2026
WordPad для Windows 11 — это приложение, которое восстанавливает классический текстовый редактор WordPad в операционной системе Windows 11. После того как Microsoft исключила WordPad из. . .
Classic Notepad for Windows 11
Jel 10.01.2026
Old Classic Notepad for Windows 11 Приложение для Windows 11, позволяющее пользователям вернуть классическую версию текстового редактора «Блокнот» из Windows 10. Программа предоставляет более. . .
Почему дизайн решает?
Neotwalker 09.01.2026
В современном мире, где конкуренция за внимание потребителя достигла пика, дизайн становится мощным инструментом для успеха бренда. Это не просто красивый внешний вид продукта или сайта — это. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru