[support] How do I make an external http call to a function within a custom module?

Pierre Rineau pierre.rineau at makina-corpus.com
Sun Oct 10 08:36:46 UTC 2010


On Sat, 2010-10-09 at 19:41 -0400, John Mitchell wrote:
> Ignore
> 
> "I want to send an http call to a java servlet which will do some
> additional processing for order fulfillment and once complete it will
> return the name of the file which it just created."
> 
> Like I said originally "How do I make an external http call to a
> function within a custom module?"
> 
> To further clarify "How do I make an (external to Drupal) http call to
> a function within a drupal custom module?"
> 
> John

Hum, I can't ignore what you said, it seems that you want to do an
external webservice call in some PHP function code. For this, depending
on the webservice you want to contact, you should look in two different
directions:

1 - Is there an existing PHP API/library somewhere to talk with this
particular webservice? If yes, and you like it, then use it.

2 - If not, then forge your request, and send it using something like
the drupal_http_request() function. If you don't like it, you can use
file_get_contents() which can do HTTP requests, or curl, or any other
third party library which is able to do it.

Hope this will help you.

Pierre.



More information about the support mailing list