FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Fatal error: Class 'HttpRequest' not found
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Fatal error: Class 'HttpRequest' not found [message #178805] Tue, 07 August 2012 17:08 Go to next message
Francisco is currently offline  Francisco
Messages: 2
Registered: August 2012
Karma: 0
Junior Member
Hello all,


I want to use extension php_http.dll but i cant succeed to do it.
First i used easyPHP version 12, then i tried to install PHP and
Appache as separate modules.

I still get the same error

Fatal error: Class 'HttpRequest' not found in
C:\Apache2\htdocs\testPHP\authenticate2.php on line 26

Its like as if php_http extention does not work on my conf, i get this
error when i use class HttpRequest.

I use the followin PHP code:

<?php
$application = '/titi/api/login';

// get input parameters
$login = $_POST['login'];
$password = $_POST['password'];
$server = $_POST['server'];
$port = $_POST['port'];

// store this in a cookie like this(for now)
$_SESSION['login'] = $login;
$_SESSION['password'] = $password;
$_SESSION['server'] = $server;
$_SESSION['port'] = $port;

$credentials = $login.':'.$password;

$options = array(
'httpauth' => base64_encode
($credentials),
'httpauthtype' => HTTP_AUTH_BASIC, // auth
basic type
'protocol' => HTTP_VERSION_1_1
);

$url = 'http://'. $server. ':' . $port . $application;
//echo $url;
$request = new HttpRequest($url,HttpRequest::METH_POST );
$request->setContentType('Content-Type: text/xml');
$request->setOptions($options);
$result = $httpRequest->send();

//print out the result
echo "<pre>"; print_r($result); echo "</pre>";
echo $resp;

?>

About my conf :

---------------APACHE-------------------------------------
I installed Apache 2.2.22 from http://www.apachelounge.com/ to get
windows binaries
I used
http://www.apachelounge.com/download/win32/binaries/httpd-2.2.22-win32-VC9. zip
I also installed necessary windows binaries, that are referenced by
apache : http://www.microsoft.com/download/en/details.aspx?id=5582

--------------PHP-----------------------------------------
I installed php from : http://windows.php.net/download/
I used the following version:
http://windows.php.net/downloads/releases/php-5.3.15-Win32-VC9-x86.msi

The php_http.dll extension was fecthed at
http://downloads.php.net/pierre/
I used the following version :
http://downloads.php.net/pierre/php_http-5.3-svn20091125-vc9-x86.zip
I droped this extension in the following directory [PHP_INSTALL]\ext
----------conf APache et
PHP-------------------------------------------------
I modified apache conf file httpd.conf to add in it :

PHPIniDir "C:\Program Files (x86)\PHP\"
LoadModule php5_module "C:\Program Files (x86)\PHP\php5apache2_2.dll"
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>


I payed a ot of attention to windows binary compatibility (VC9, x86,
win32) for compilation options used for each components.

It seems to work so far because when i used command line "php -m" i get
:

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
filter
ftp
gd
gettext
gmp
hash
http
iconv
imap
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
pgsql
Phar
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
zip
zlib

and when i use command line "php --ri http" I get :

http

HTTP Support => enabled
Extension Version => 1.7.0-dev
Registered Classes => HttpUtil, HttpMessage, HttpRequest,
HttpRequestPool, HttpRequestDataShare, HttpDeflateStream,
HttpInflateStream, HttpResponse, HttpQueryString
Output Handlers => ob_deflatehandler, ob_inflatehandler, ob_etaghandler
Stream Filters => http.chunked_decode, http.chunked_encode,
http.deflate, http.inflate

Used Library => Compiled => Linked
libcurl => 7.19.6 => 7.19.6
libevent => disabled => disabled
libz => 1.2.3 => 1.2.3
libmagic => disabled => disabled

Persistent Handles
Provider => Ident => Used => Free
http_request => N/A => 0 => 0
http_request_datashare => GLOBAL => 1 => 0
http_request_datashare_lock => GLOBAL => 1 => 0
http_request_pool => N/A => 0 => 0

Request Methods
Registered => GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT,
PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL,
REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, MKWORKSPACE, UPDATE,
LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, ACL,
Allowed => (ANY)

Directive => Local Value => Master Value
http.etag.mode => MD5 => MD5
http.log.cache => no value => no value
http.log.redirect => no value => no value
http.log.not_found => no value => no value
http.log.allowed_methods => no value => no value
http.log.composite => no value => no value
http.request.methods.allowed => no value => no value
http.request.methods.custom => no value => no value
http.request.datashare.cookie => 0 => 0
http.request.datashare.dns => 1 => 1
http.request.datashare.ssl => 0 => 0
http.request.datashare.connect => 0 => 0
http.send.inflate.start_auto => 0 => 0
http.send.inflate.start_flags => 0 => 0
http.send.deflate.start_auto => 0 => 0
http.send.deflate.start_flags => 0 => 0
http.persistent.handles.limit => -1 => -1
http.persistent.handles.ident => GLOBAL => GLOBAL
http.send.not_found_404 => 1 => 1

I am out of ideas, I am a PHP beginner.
Does someone has any ideas about what i am doing wrong here?
Any new ideas about what to check ?
Thanks for your help !
Re: Fatal error: Class 'HttpRequest' not found [message #178806 is a reply to message #178805] Tue, 07 August 2012 17:09 Go to previous messageGo to next message
Francisco is currently offline  Francisco
Messages: 2
Registered: August 2012
Karma: 0
Junior Member
Francisco has brought this to us :
> Hello all,
>
>
> I want to use extension php_http.dll but i cant succeed to do it.
> First i used easyPHP version 12, then i tried to install PHP and Appache as
> separate modules.
>
> I still get the same error
>
> Fatal error: Class 'HttpRequest' not found in
> C:\Apache2\htdocs\testPHP\authenticate2.php on line 26
>
> Its like as if php_http extention does not work on my conf, i get this error
> when i use class HttpRequest.
>
> I use the followin PHP code:
>
> <?php
> $application = '/titi/api/login';
>
> // get input parameters
> $login = $_POST['login'];
> $password = $_POST['password'];
> $server = $_POST['server'];
> $port = $_POST['port'];
>
> // store this in a cookie like this(for now)
> $_SESSION['login'] = $login;
> $_SESSION['password'] = $password;
> $_SESSION['server'] = $server;
> $_SESSION['port'] = $port;
>
> $credentials = $login.':'.$password;
>
> $options = array(
> 'httpauth' => base64_encode ($credentials),
> 'httpauthtype' => HTTP_AUTH_BASIC, // auth basic
> type
> 'protocol' => HTTP_VERSION_1_1
> );
>
> $url = 'http://'. $server. ':' . $port . $application;
> //echo $url;
> $request = new HttpRequest($url,HttpRequest::METH_POST );
> $request->setContentType('Content-Type: text/xml');
> $request->setOptions($options);
> $result = $httpRequest->send();
>
> //print out the result
> echo "<pre>"; print_r($result); echo "</pre>";
> echo $resp;
>
> ?>
>
> About my conf :
>
> ---------------APACHE-------------------------------------
> I installed Apache 2.2.22 from http://www.apachelounge.com/ to get windows
> binaries
> I used
> http://www.apachelounge.com/download/win32/binaries/httpd-2.2.22-win32-VC9. zip
> I also installed necessary windows binaries, that are referenced by apache :
> http://www.microsoft.com/download/en/details.aspx?id=5582
>
> --------------PHP-----------------------------------------
> I installed php from : http://windows.php.net/download/
> I used the following version:
> http://windows.php.net/downloads/releases/php-5.3.15-Win32-VC9-x86.msi
>
> The php_http.dll extension was fecthed at http://downloads.php.net/pierre/
> I used the following version :
> http://downloads.php.net/pierre/php_http-5.3-svn20091125-vc9-x86.zip
> I droped this extension in the following directory [PHP_INSTALL]\ext
> ----------conf APache et PHP-------------------------------------------------
> I modified apache conf file httpd.conf to add in it :
>
> PHPIniDir "C:\Program Files (x86)\PHP\"
> LoadModule php5_module "C:\Program Files (x86)\PHP\php5apache2_2.dll"
> <FilesMatch \.php$>
> SetHandler application/x-httpd-php
> </FilesMatch>
>
>
> I payed a ot of attention to windows binary compatibility (VC9, x86, win32)
> for compilation options used for each components.
>
> It seems to work so far because when i used command line "php -m" i get :
>
> [PHP Modules]
> bcmath
> bz2
> calendar
> Core
> ctype
> curl
> date
> dom
> ereg
> exif
> filter
> ftp
> gd
> gettext
> gmp
> hash
> http
> iconv
> imap
> json
> libxml
> mbstring
> mcrypt
> mhash
> mysql
> mysqli
> mysqlnd
> odbc
> openssl
> pcre
> PDO
> pdo_mysql
> PDO_ODBC
> pdo_sqlite
> pgsql
> Phar
> Reflection
> session
> SimpleXML
> soap
> sockets
> SPL
> sqlite3
> standard
> tidy
> tokenizer
> wddx
> xml
> xmlreader
> xmlrpc
> xmlwriter
> zip
> zlib
>
> and when i use command line "php --ri http" I get :
>
> http
>
> HTTP Support => enabled
> Extension Version => 1.7.0-dev
> Registered Classes => HttpUtil, HttpMessage, HttpRequest, HttpRequestPool,
> HttpRequestDataShare, HttpDeflateStream, HttpInflateStream, HttpResponse,
> HttpQueryString
> Output Handlers => ob_deflatehandler, ob_inflatehandler, ob_etaghandler
> Stream Filters => http.chunked_decode, http.chunked_encode, http.deflate,
> http.inflate
>
> Used Library => Compiled => Linked
> libcurl => 7.19.6 => 7.19.6
> libevent => disabled => disabled
> libz => 1.2.3 => 1.2.3
> libmagic => disabled => disabled
>
> Persistent Handles
> Provider => Ident => Used => Free
> http_request => N/A => 0 => 0
> http_request_datashare => GLOBAL => 1 => 0
> http_request_datashare_lock => GLOBAL => 1 => 0
> http_request_pool => N/A => 0 => 0
>
> Request Methods
> Registered => GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT,
> PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL,
> REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, MKWORKSPACE, UPDATE,
> LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, ACL,
> Allowed => (ANY)
>
> Directive => Local Value => Master Value
> http.etag.mode => MD5 => MD5
> http.log.cache => no value => no value
> http.log.redirect => no value => no value
> http.log.not_found => no value => no value
> http.log.allowed_methods => no value => no value
> http.log.composite => no value => no value
> http.request.methods.allowed => no value => no value
> http.request.methods.custom => no value => no value
> http.request.datashare.cookie => 0 => 0
> http.request.datashare.dns => 1 => 1
> http.request.datashare.ssl => 0 => 0
> http.request.datashare.connect => 0 => 0
> http.send.inflate.start_auto => 0 => 0
> http.send.inflate.start_flags => 0 => 0
> http.send.deflate.start_auto => 0 => 0
> http.send.deflate.start_flags => 0 => 0
> http.persistent.handles.limit => -1 => -1
> http.persistent.handles.ident => GLOBAL => GLOBAL
> http.send.not_found_404 => 1 => 1
>
> I am out of ideas, I am a PHP beginner.
> Does someone has any ideas about what i am doing wrong here?
> Any new ideas about what to check ?
> Thanks for your help !

Oh I forgot to say i added the extension php_http.dll in php.ini file.
Re: Fatal error: Class 'HttpRequest' not found [message #178807 is a reply to message #178806] Tue, 07 August 2012 17:28 Go to previous message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 07/08/12 19:09, Francisco wrote:

>> Fatal error: Class 'HttpRequest' not found in
>> C:\Apache2\htdocs\testPHP\authenticate2.php on line 26
>>
>> Its like as if php_http extention does not work on my conf, i get this
>> error when i use class HttpRequest.

You need to install pecl_http 0.10.0 or later, please read the following
pages:

http://www.php.net/manual/en/http.setup.php

--

//Aho
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Handling with xmlhttp.responseText
Next Topic: Re: Php used
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 11:04:45 GMT 2024

Total time taken to generate the page: 0.02828 seconds