Jump to content

HttpRequest in controller


nisargPresta
 Share

Recommended Posts

Hi guys;

 

 

Im working on a module developement where I'm supposed to pass an array through HttpRequest  can anyone help me ? How can I run following code :

 

$request = new HttpRequest($url,HttpRequest::METH_POST);
                        $request->addPostFields($dataHash);
                        try
                        {
                                $response= $request->send()->getBody();
                                //echo $response;
                                return $response;
                        }
                        catch (HttpException $ex)
                        {
                                //echo $ex;
                                logEvent('fatal','Exception during Request'.$request);
                        }

 

 

Array -> dataHash contains values fetched by Tools::getValue('name'), from the previous form submission in a view.

As and when I create a object forHttpRequest controller crashes and shows a blank white page.

Please help me coming up with a solution.

 

Regards

-Nisarg

Share this post


Link to post
Share on other sites

Hi;

 

As you mentioned above I enabled error reporting . Following error message was seen:

 

Fatal error: Class 'HttpRequest' not found in D:\xampp\htdocs\.. on line 119

 

And that's a PHP error because the extension which provides HttpRequest is not installed on your server

You need to install this extension

http://us.php.net/manual/en/book.http.php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More