Jump to content

HTTP Request and the PHP.ini file


tftr_si

Recommended Posts

Hi there guys and gals.

 

I am teaching myself PHP at the moment and very new to it all but have a lot of experience in other various languages. That said, I am a 'n00b' so any help on this would be appreciated ;D

 

I want to be able to carry out a HTTP request via my code. At the moment, I get the following error:

"Fatal error: Class 'HttpRequest' not found"

I'm aiming to use it to call out to the Last.FM API on my fanzine site.

 

I have read that I need to add/enable the following line in my php.ini file:

extension=php_http.dll

 

Is this true? I'm not able to find my php.ini file anywhere on my host so what would this look like? Do I just drop it in the site root or do i need to explicitly reference it in my code?

 

Would the file look something like this?

<?php
extension=php_http.dll
?>

 

Also - if there is a better alternative to HTTP Request - let me know. I know PHP has a wealth of cool pre-written methods.

Link to comment
https://forums.phpfreaks.com/topic/195812-http-request-and-the-phpini-file/
Share on other sites

I recommend cURL.  There are lots of tutorials/posts on how to use it already.  Search the forums or Google and you will find one quickly.

 

As to your question, your host may not let you modify php.ini. Search their FAQ's. The php.ini file itself is not a .php file, so you aren't going to have <?php or ?>.

I recommend you download XAMPP (or just a PHP binary), install it, and take a look around so you can see what the full php.ini file looks like.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.