2

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

  • did you try like this $this->getRequest()->getParams('params') ? – ASQ Sep 3 at 10:54
  • yes i already tried with that code but same result empty array – Sanjay Shiyal Sep 3 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 – Sanjay Shiyal Sep 3 at 11:05
  • $this->_request->getParams() or have you test with $_GET – Anas Mansuri Sep 3 at 11:07
  • @AnasMansuri i already try but no result – Sanjay Shiyal Sep 3 at 11:19
3

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
    Thank you so much Work Great !!! – Sanjay Shiyal Sep 3 at 11:37
2

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!

  • i also tried with this but no result empty array – Sanjay Shiyal Sep 3 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.