How to use JHttp class?

75 views
Skip to first unread message

Viper

unread,
Jul 12, 2013, 12:16:57 PM7/12/13
to joomla-de...@googlegroups.com
Can anyone help me? I'm cannot find any documentation about this class.

Simple method in contoller:

public function remoteData() {
    $options = new JRegistry;
    $options->set('follow_location', false);
    $http = JHttpFactory::getHttp($options, 'curl');
    $response = $http->get('http://localhost/administrator/index.php?option=com_mycomponent', array('Origin'=>'google.com'), 30);

    echo $response->body;
}


I'm right? Or maybe there is a light and elegant way to complete this task?

Michael Babker

unread,
Jul 12, 2013, 1:43:55 PM7/12/13
to joomla-de...@googlegroups.com
The only way it could be simpler is if you weren't setting options before getting the JHttp transport.  You've got it right for a simple GET request.
--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send an email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
- Michael

Please pardon any errors, this message was sent from my iPhone.

Reply all
Reply to author
Forward
0 new messages