[development] Using the Forms API to post information to an external source

Jamie Holly hovercrafter at earthlink.net
Tue Aug 25 16:56:16 UTC 2009


If you specify it as a full url ie:

$form['#action']='http://www.mysite.com/formhandler/';

It should work. I use the same thing on a site in D6 where videos 
uploaded are uploaded directly to our encoding server and it handles all 
the validations, etc.

Jamie Holly
http://www.intoxination.net 
http://www.hollyit.net



Brian Vuyk wrote:
> Oops - that was a typo. #action was indeed what I meant, however, it 
> only allows internal Drupal paths, so I can't point to to anything outside.
>
> Brian
>
> Jamie Holly wrote:
> > #method specifies the way the form is submitted (either POST or GET). 
> > You want to change [#action] to the URL you want. Of course doing that 
> > will remove any validation from the form in FAPI. You will have to do 
> > all the validation yourself.
> >
> > Jamie Holly
> > http://www.intoxination.net http://www.hollyit.net
> >
> >
> >
> > Brian Vuyk wrote:
> >> Hello all.
> >>
> >> For one of my clients, we have a long multistep form that we use to 
> >> collect information for a user and enroll him / her in a course. One 
> >> thing we would like to do is POST some information to an external API.
> >>
> >> Is it possible, using the FAPI, to POST data to an external source? I 
> >> was going to user $form['#method'], however, that only allows 
> >> internal paths.
> >>
> >> Worst case scenario, I could create a custom submit callback which 
> >> POSTS the data over using CURL, but I am hoping to find a more 
> >> elegant solution.
> >>
> >> Any suggestions?
> >>
> >> Thanks in advance,
> >>
> >> Brian
> >>
> >>   
>
>
>   


More information about the development mailing list