[support] Using drupal_http_request

Steve Edwards killshot91 at comcast.net
Fri Nov 23 20:49:29 UTC 2007


For some reason, I'm having problems getting to the point where I can 
even call drupal_http_request().  I changed my module slightly so that 
the form is modified in hook_user().  But for some reason, I can't get 
anything to happen when $op = 'insert' or $op == 'register'.  I would 
like to see the form data I have available, but when I put something 
like "drupal_set_message('<pre>'. print_r($user, TRUE) .'</pre>');" in 
the 'insert' case, I get absolutely nothing.  How can I get my data to 
be displayed so I can see it?  Is there a way to do it with the devel 
module?

Thanks.

Steve

support-request at drupal.org wrote:
> Send support mailing list submissions to
> 	support at drupal.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.drupal.org/listinfo/support
> or, via email, send a message with subject or body 'help' to
> 	support-request at drupal.org
>
> You can reach the person managing the list at
> 	support-owner at drupal.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of support digest..."
>
>
> Today's Topics:
>
>    1. Using drupal_http_request() (Steve Edwards)
>    2. converting podcasts to feeds (Sarah.Vardy at student.griffith.edu.au)
>    3. Re: book module (Eric-Alexander Schaefer)
>    4. Re: Using drupal_http_request() (Saint-Genest Gwenael)
>    5. Re: Locking down drupal for use by multiple	(semi-)untrusted
>       administrators (Saint-Genest Gwenael)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 20 Nov 2007 22:20:18 -0800
> From: Steve Edwards <killshot91 at comcast.net>
> Subject: [support] Using drupal_http_request()
> To: support at drupal.org
> Message-ID: <4743CE22.8030708 at comcast.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> I've jumped in to finish up a site that someone else started (yee ha!), and I need to do two things with the user registration data:
>
> 1) Add some custom fields to the user registration form (i.e. address/city/state/zip, job title, occupation, company, etc.)
> 2) Use the data to add the user to an embedded mail list manager program (Oempro by Octeth).
>
> Oempro can generate a script that adds the data to their database, and I can post to that script.  I modified the user 
> registration form and added fields using hook_form_alter(), and that works fine.  The next step is to use hook_user() when $op == 
> 'insert' to post the user data to the Oempro script using drupal_http_request().  This brings up two issues:
>
> 1) How can I access the user data in hook_user()?  Is it part of $user at that point, or would it be in $edit?  Or another place?
> 2) How do I use drupal_http_request()?  Unfortunately I'm not very familiar with HTTP headers or with this function, so I'm not 
> sure what to do.  For instance, do I put the form data (assuming I can get to it in hook_user()) to the $data parameter in array 
> form?  And what do I put in the $header variable for a request like this?
>
> Thanks.
>
> Steve
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 21 Nov 2007 16:29:39 +1000
> From: Sarah.Vardy at student.griffith.edu.au
> Subject: [support] converting podcasts to feeds
> To: support at drupal.org
> Message-ID: <f561ec2a51cd.47445cf3 at student.griffith.edu.au>
> Content-Type: text/plain; charset="us-ascii"
>
>
>     Hi,
> I was wondering if there is a pre-existing module that converts
> podcasts to feeds in drupal? ie. so a user can upload a podcast to the
> Drupal cms and this is automatically converted to a feed? 
> Any help would rock!
> Sarah
>   
>
> Research Computing Services
> Sarah.Vardy at student.griffith.edu.au
> 0402241794
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.drupal.org/pipermail/support/attachments/20071121/96536506/attachment.html 
>
> ------------------------------
>
> Message: 3
> Date: Wed, 21 Nov 2007 08:07:19 +0100
> From: Eric-Alexander Schaefer <eric at gixgax.de>
> Subject: Re: [support] book module
> To: support at drupal.org
> Message-ID: <4743D927.8010906 at gixgax.de>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Sarah.Vardy at student.griffith.edu.au schrieb:
>   
>> |<?php $node_result = db_query(db_rewrite_sql('SELECT n.nid, n.title, 
>> b.parent, f.filepath FROM {node} n INNER JOIN {book} b ON {n.vid = 
>> b.vid} n join
>>   {image_attach} nr on (n.nid = nr.nid)INNER JOIN {files} f ON nr.iid = 
>> f.nid WHERE n.nid = %d && f.filename = 'thumbnail''), $nid);
>>     
>
> Your query string ends after "f.filename = ", because you put the whole 
> string in single quotes ['] and "thumbnail" as well. Replace either ones 
> with double quotes ["].
>
> HTH,
> Eric
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 21 Nov 2007 12:25:21 +0100
> From: Saint-Genest Gwenael <gwenael.saint-genest at makina-corpus.com>
> Subject: Re: [support] Using drupal_http_request()
> To: support at drupal.org
> Message-ID: <474415A1.2070905 at makina-corpus.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Steve Edwards wrote:
>   
>> I've jumped in to finish up a site that someone else started (yee ha!), and I need to do two things with the user registration data:
>>
>> 1) Add some custom fields to the user registration form (i.e. address/city/state/zip, job title, occupation, company, etc.)
>> 2) Use the data to add the user to an embedded mail list manager program (Oempro by Octeth).
>>
>> Oempro can generate a script that adds the data to their database, and I can post to that script.  I modified the user 
>> registration form and added fields using hook_form_alter(), and that works fine.  The next step is to use hook_user() when $op == 
>> 'insert' to post the user data to the Oempro script using drupal_http_request().  This brings up two issues:
>>
>> 1) How can I access the user data in hook_user()?  Is it part of $user at that point, or would it be in $edit?  Or another place?
>> 2) How do I use drupal_http_request()?  Unfortunately I'm not very familiar with HTTP headers or with this function, so I'm not 
>> sure what to do.  For instance, do I put the form data (assuming I can get to it in hook_user()) to the $data parameter in array 
>> form?  And what do I put in the $header variable for a request like this?
>>
>> Thanks.
>>
>> Steve
>>     
>
>
> Hi !
>
> 1) Yes, you can use $user to access the user data.
>
> When a new registration is made you have :
>  - a call to hook_user() with op=register , without $user data
>  - a call to hook_user() with op=load     , without $user data
>  - a call to hook_user() with op=validate , without $user data
> ( If this steps ar ok, user will be added to drupal)
>  - a call to hook_user() with op=load     and $user contain user data
>  - a call to hook_user() with op=insert   and $user contain user data
>  - a call to hook_user() with op=load     and $user contain user data
>
> 2) How can you send data to you script ? GET ? POST ?
>
> If your script can use GET datas just add them to URL. For example :
>   // Create URL with site name
>   $url  = "http://www.google.fr";
>   // Add some GET arguments
>   $url .= "/search?q=drupal&&ie=utf-8&oe=utf-8&aq=t";
>   // Make HTTP request
>   $result = drupal_http_request($url);
>
> Gwen
>
>
> ------------------------------
>
> Message: 5
> Date: Wed, 21 Nov 2007 12:41:26 +0100
> From: Saint-Genest Gwenael <gwenael.saint-genest at makina-corpus.com>
> Subject: Re: [support] Locking down drupal for use by multiple
> 	(semi-)untrusted administrators
> To: support at drupal.org
> Message-ID: <47441966.60306 at makina-corpus.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hugo Mills wrote:
> (snip)
>   
>> 1) Themes.
>>
>>    From my limited investigation so far, it seems that Drupal themes
>> are basically PHP. Allowing users to upload themes directly is
>> therefore a no-no. Is there a non-executable type of theme that we can
>> support direct uploads for safely, or will all uploaded themes have to
>> be audited before we allow them up? How flexible would the system be
>> if we were to prevent theme uploads completely?
>>     
>
>     I think, for the moment, all drupal themes must contain PHP code.
> Maybe you can pre-install some popular theme and suggest user to request
> other themes by mail to admin ? Maybe you can use some themes from
> themegarden ?
>     For more flexibility to can allow users to upload personal images
> for theme.
>
>   
>> 4) What else have I forgotten or overlooked?
>>
>>    The chances of having a malicious user are probably fairly small in
>> this set-up, but I'd like to keep it as "clean" as possible, so
>> pointing out any other glaring holes that would allow a site
>> administrator to execute arbitrary code on the server would be useful.
>>     
>
>     I've never use multisite-mode but i'm interested by your experience
> return.
>
> Gwen
>
>   


More information about the support mailing list