Can I get $_SERVER['HTTP_USER_AGENT']...

User 2113375 Photo


Registered User
10 posts

Can someone tell me how to get the response from $_SERVER['HTTP_USER_AGENT'] into the email notification I receive from my webform?
See my app at https://www.livebolivar.com/site_html/a … ed/app.php
Microsoft Windows [Version 10.0.17134.706]
web form builder 2.5 build 5437
php 5.6
Link to my form: https://www.livebolivar.com/site_html/a … ed/app.php
The page validates at https://validator.w3.org/nu/?doc=https: … ed/app.php
Microsoft Windows [Version 10.0.17134.706]
WEB FORM BUILDER v2.5 BUILD 5437 registered
GODADDY linux economy with cpanel.
CloudLinux OS / CentOS 6?
apache 2.4.33
php 5.6.36
bash 4.1.2(2)-release
cPanel 78.0.18
Perl 5.10.1
notepad++7.6.6 build time : apr 3 2019
User 187934 Photo


Senior Advisor
20,188 posts

Hi AJ,
Is your form hosted on S-Drive?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2113375 Photo


Registered User
10 posts

no.
Link to my form: https://www.livebolivar.com/site_html/a … ed/app.php
The page validates at https://validator.w3.org/nu/?doc=https: … ed/app.php
Microsoft Windows [Version 10.0.17134.706]
WEB FORM BUILDER v2.5 BUILD 5437 registered
GODADDY linux economy with cpanel.
CloudLinux OS / CentOS 6?
apache 2.4.33
php 5.6.36
bash 4.1.2(2)-release
cPanel 78.0.18
Perl 5.10.1
notepad++7.6.6 build time : apr 3 2019
User 187934 Photo


Senior Advisor
20,188 posts

There's a couple of ways to do this.
I would place an input on your form and hide with css or Jquery.
Then place this in the input as the value.
value="<?php echo $_SERVER['HTTP_USER_AGENT'];?>"


You'll need to set your server to parse php within html.
https://encodable.com/parse_html_files_as_php/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2113375 Photo


Registered User
10 posts

Results:
It did not work for me.
The page in question is hosted on Godaddy. Some of the content is cached by cloudflare. The cache was completely purged and disabled. The page was viewed with Firefox in private mode.

Added to top-level .htaccess:
# set your server to parse php within html.
# https://encodable.com/parse_html_files_as_php/
# begin displays all the PHP code ("echo", etc)
# AddHandler x-httpd-php .html .htm
# AddType application/x-httpd-php .htm
# end displays all the PHP code ("echo", etc)

# begin prompts me to choose "What should Firefox do with this file?"
# AddHandler php-script .php .html .htm
# AddHandler php5-script .php .html .htm
# AddType application/x-httpd-php .html
# end prompts me to choose "What should Firefox do with this file?"

Used in my form:
<div class="fb-input-box">
<input name="item79REFERENCE2" id="item79" type="text" maxlength="254"
placeholder="" autocomplete="off" data-hint="" value="<?php echo $_SERVER['HTTP_USER_AGENT'];?>" />
</div>

Results: See .htaccess above. Nothing worked.

The objective:
Get the user agent info into the email notification sent from my form. Your info has nothing to do with getting the user agent info into the email notification but I like it so I might use it for something else if I can get it to work.

Link to my form: https://www.livebolivar.com/site_html/a … ed/app.php
The page validates at https://validator.w3.org/nu/?doc=https: … ed/app.php
Microsoft Windows [Version 10.0.17134.706]
WEB FORM BUILDER v2.5 BUILD 5437 registered
GODADDY linux economy with cpanel.
CloudLinux OS / CentOS 6?
apache 2.4.33
php 5.6.36
bash 4.1.2(2)-release
cPanel 78.0.18
Perl 5.10.1
notepad++7.6.6 build time : apr 3 2019
User 187934 Photo


Senior Advisor
20,188 posts

AJ wrote:
Your info has nothing to do with getting the user agent info into the email notification

Can you enlighten me on how it doesn't?:lol:
Are you using the script provided by the Form Builder? If so remove the script that raps the iframe code.
Can you share a link to the form?
Were you able to parse php within your html?
Working here.
https://ericrohloff.com/coffeecup/ccfor … ser_agent/
I have it going to the Confirmation but you can make yours be notification. I don't need to be hammered with emails.:lol:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.