3

http://mystagesite.com/magento232/custom/module/check/?params=<%3Fxml+version%3D"1.0"+encoding%3D"UTF-8"+standalone%3D"yes"%3F>6<%2FRESPONSECODE>Invalid+Session+Token%3A+Session+has+Timed+Out<%2FRESPONSEDESCRIPTION><%2FRESULT>

In above url , api returns some parameters in xml format

I have to get value of params in check contoller but i have got only empty array

using this code $this->getRequest()->getParams()

I already tried above code but it shows empty array

if i remove first three character from parameter %3F than i got result but that parameter returns from api so can't change that one

so if anyone have idea about this than please let me know

5
  • did you try like this $this->getRequest()->getParams('params') ? Commented Sep 3, 2019 at 10:54
  • yes i already tried with that code but same result empty array Commented Sep 3, 2019 at 11:03
  • if i remove first three character from parameter %3F than i got result but that parameter returns from api so can't change that one Commented Sep 3, 2019 at 11:05
  • $this->_request->getParams() or have you test with $_GET Commented Sep 3, 2019 at 11:07
  • @AnasMansuri i already try but no result Commented Sep 3, 2019 at 11:19

2 Answers 2

5

Try with below code other option:

$url = 'http://mystagesite.com/magento232/custom/module/check/?params=<%3Fxml+version%3D"1.0"+encoding%3D"UTF-8"+standalone%3D"yes"%3F>6<%2FRESPONSECODE>Invalid+Session+Token%3A+Session+has+Timed+Out<%2FRESPONSEDESCRIPTION><%2FRESULT>'; $url_data = parse_url($url); parse_str($url_data['query'], $params); echo $params['params']; 

hope its work for you

1
  • 1
    Thank you so much Work Great !!! Commented Sep 3, 2019 at 11:37
3

You can try with Below code:

protected $request; public function __construct( ... \Magento\Framework\App\Request\Http $request, ... ) { $this->request = $request; } $this->request->getParam('your_param'); 

Hope this help you!

1
  • i also tried with this but no result empty array Commented Sep 3, 2019 at 11:06

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.