Downloading PHP Script instead of executing in IE7

I'm having some trouble submitting HTML form data to a PHP script on a secure site using IE7.

The code itself is a very basic HTML form with no special function other than to submit the data in it's fields to an HTTPS address. When i submit the form in IE6 or FireFox it works fine, the results of the post are returned to the browser as expected. However when i submit the form using IE7, the browser attempts to download the PHP script to my local drive instead of executing it.

I can't find any security settings in IE7 or windows that would indicate this as the preferred action. I have made sure i have the most current updates for IE7, but the result is the same. I have tried the posting on other machines and they all work fine as long as they are not running IE7.

The goal of this form was supposed to be a quick and easy way to avoid having to use an HTTP class/object in Visual FoxPro to post a set of data from our database to an external site. We needed the solution to be quick and cost/time effective as we're not familliar with posting via HTTP. And so i created an Internet Explorer object in a foxpro form, navigated to an html file on our local server and submit the HTML form in attempt to easilly send an HTTP post. But IE7 appears to have other plans!

Any ideas why IE7 is attempting to download the PHP script instead of passing the post data and executing the script? I'm hoping this is something really quick and simple because i need to get on with parsing the response from ths script.

Alternatively a relatively quick and easy way to post urlencoded data in FoxPro would be just as good!

Thanks in advance!
mobshopAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marcus BointonCommented:
I suggest you take a look at the traffic between client and server - Microsoft's Fiddler2 acts as a proxy to allow you examine all the requests and responses. When you say it's downloading the PHP script, does it actually download the script or just something with the script's name? What do you actually receive? I'd be looking at content type headers for behaviour like that.
0
mobshopAuthor Commented:
Thanks Squinky, i'll download fiddler2 and see what i can see.

In the meantime: IE7 prompts me to download the file. I have the option to Open, Save or Cancel. If i choose to Open or Save (then open the saved file), i end up in a loop of constantly being prompted to Open, Save or Cancel the same file. The file it's asking me to Save/Open is a .php file, the prompt lists it as a PHP_auto_file.
0
mobshopAuthor Commented:
Just as an update: Fiddler2 shows only a CONNECT request to the server, there is no response recorded.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Marcus BointonCommented:
I know it says that it's a PHP file, but what does it actually contain? Open it in a text editor.

There must be something amiss with Fiddler there - if you don't see a POST and a response then it's not working - try going to any other site and you should see the requests. CONNECT is not an HTTP request.
0
Steve BinkCommented:
I would venture to say this is a configuration error on the server side.  When a server fields a request from a client, it sends back a Content-Type attribute in the HTTP headers.  This attribute directs the browser to handle these requests in a certain way.  The basic content types, such as text/html and text/css, are hard-coded into the client software.  If the server is returning an 'unknown' or malformed content type, the browser will not understand what to do with it, and prompt you for what you want to do.

Below is an excerpt from an HTTP exchange with apache.org.  This is just the first three entries...if you followed the conversation, you would also see requests for images, etc.
http://httpd.apache.org/docs/2.0/
 
GET /docs/2.0/ HTTP/1.1
Host: httpd.apache.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Sun, 02 Sep 2007 13:52:43 GMT
If-None-Match: "b8bd92-1cdd-439275ec020c0;3a72e-25b-3fc7c8f552c40"-gzip
Cache-Control: max-age=0
 
HTTP/1.x 200 OK
Date: Fri, 01 Feb 2008 11:42:28 GMT
Server: Apache/2.2.8 (Unix)
Content-Location: index.html.en
Vary: negotiate,accept-language,accept-charset,Accept-Encoding
TCN: choice
Last-Modified: Sun, 02 Sep 2007 13:52:43 GMT
Etag: "b8bd92-1cdd-439275ec020c0;3a72e-25b-3fc7c8f552c40"-gzip
Accept-Ranges: bytes
Content-Encoding: gzip
Content-Length: 2157
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
Content-Language: en
----------------------------------------------------------
http://httpd.apache.org/docs/2.0/style/css/manual.css
 
GET /docs/2.0/style/css/manual.css HTTP/1.1
Host: httpd.apache.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://httpd.apache.org/docs/2.0/
If-Modified-Since: Sun, 20 Aug 2006 18:28:55 GMT
If-None-Match: "3b6d0-4856-41b772a8107c0"-gzip
Cache-Control: max-age=0
 
HTTP/1.x 200 OK
Date: Fri, 01 Feb 2008 11:42:28 GMT
Server: Apache/2.2.8 (Unix)
Last-Modified: Sun, 20 Aug 2006 18:28:55 GMT
Etag: "3b6d0-4856-41b772a8107c0"-gzip
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 4076
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/css
----------------------------------------------------------
http://httpd.apache.org/docs/2.0/style/css/manual-loose-100pc.css
 
GET /docs/2.0/style/css/manual-loose-100pc.css HTTP/1.1
Host: httpd.apache.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://httpd.apache.org/docs/2.0/
If-Modified-Since: Sun, 20 Aug 2006 18:28:55 GMT
If-None-Match: "3b6cc-bf9-41b772a8107c0"-gzip
Cache-Control: max-age=0
 
HTTP/1.x 200 OK
Date: Fri, 01 Feb 2008 11:42:28 GMT
Server: Apache/2.2.8 (Unix)
Last-Modified: Sun, 20 Aug 2006 18:28:55 GMT
Etag: "3b6cc-bf9-41b772a8107c0"-gzip
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1109
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Content-Type: text/css

Open in new window

0
mobshopAuthor Commented:
When i open the file in notepad it contains the response string that i get returned to the browser when using IE6 or FireFox.

I had to turn the HTTPS Decryption on for fiddler to pick up the response.
Fiddler shows the response i need, as a plain text type. So there is a response, but IE7 appears to interpret this differently than IE6 and FireFox, prompting to save the response to file instead of returning it to the browser.

It has made me think though that if there was a setting in fiddler to decrypt HTTPS responses, is there something similar in IE7?

I need it to return the reponse to the browser (as in IE6 and ForeFox) as this call will be made programmatically, from an unmanned machine, automatically several times a day. I need to capture and parse the response and then perform various actions in our database depending on the responses.
0
Marcus BointonCommented:
Can you post the actual request and response? Do you have other machines with IE on that you can test with to see if it's not your local config that's at fault? e.g. you might have IE set to download items with a content type of text/plain.

I agree that it's total overkill to have to use IE just to do a simple POST from your code.

There are HTTP examples here: http://www.example-code.com/foxpro/http.asp mostly using this plugin: http://www.chilkatsoft.com/HttpDotNet.asp
0
mobshopAuthor Commented:
I've included the code for the HTML page being used to POST the data, minus the actual server addresses. The response really is simply plain text:

ERROR: order_ref  - Order reference not specified
RESULT: 0

There is no actual error with this response, i'm posting the form blank initially, because i need to handle any errors that are returned, but we have posted valid data successfully using firefox and IE6.

The first thing we did was try the same thing on other machines. It works on other machines in IE6 and FireFox but not in IE7. The same as my own machine, so we deduced it must be something IE7 specific. All the machines on the network are setup to be identical.

Yeah, I could have used an HTTP class/object but we're not familliar with the the process, our knowledge is mainly application based programming, specifically Visual FoxPro, and we've never needed to POST via HTTP until now. We intended to use the simple HTML form as a quick-fix and develop a full HTTP solution in VFP code at a later date. Turns out if i'd spent all my time working with an HTTP class i probably would have had it all sorted and done in VFP code by now! Sod's law i suppose!

I'm not sure those plugins would work, we're running VFP version 7 currently, i don't think it has any support for .NET. The class i'm hoping to work with eventually is "MSXML2.ServerXMLHTTP" which i looked at while waiting for question response, among other things. I may end up having to do the full solution yet!

Thanks again!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML 
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Vanilla Post Form</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY>To specify number of options or items needed you can pass the parameter in 
the URL e.g. <A 
href="http://<local site goes here>/vanilla_form.php?items=3&amp;options=2">?items=3&amp;options=2</A> 
if you do not specify the default is 1 each<BR><BR>You may or may not need the 
following options depending on how you implement the communications.<BR>If you 
wish you can pass the contents of fields to the script in the URL, the names to 
use are shown next to each entry box on the page e.g. <A 
href="http://<local site goes here>/vanilla_form.php?items_0=hello|test&amp;personal=hello world">?items_0=hello|test&amp;personal=hello 
world</A><BR>You can submit the form on page load by passing sumbit in the URL 
e.g. <A 
href="http://<local site goes here>/vanilla_form.php?submit=1">?submit=1</A><BR>You can 
use all of these various options interchangeably, simply build up the URL as you 
need it. 
<FORM id=vanform name=vanform 
action=https://<secure site goes here>/whitelabel/orderImport.php 
method=post>wlcode <INPUT id=wlcode name=wlcode><BR>order_ref <INPUT 
id=order_ref name=order_ref><BR>datafeed_time <INPUT id=datafeed_time 
name=datafeed_time><BR>items_0 <INPUT id=items_0 name=items[0]><BR>items_1 
<INPUT id=items_1 name=items[1]><BR>test <INPUT id=test name=test><BR>verbose 
<INPUT id=verbose name=verbose><BR>personal <TEXTAREA id=personal name=personal rows=20 cols=80></TEXTAREA><BR>Help <INPUT 
id=Help name=Help><BR>affiliate <INPUT id=affiliate name=affiliate><BR><INPUT id=go type=submit value=go name=go> 
</FORM></BODY></HTML>

Open in new window

0
Marcus BointonCommented:
Well that code looks old-school but otherwise fine :), but I don't think that's the problem anyway. It's the actual HTTP traffic that's of interest. It's most likely that the POST is working fine, but that the response is in some way odd, and I can't see that from what you've posted. If you can't get fiddler to show you that, install firebug (http://www.getfirebug.com/) in firefox and look at the 'net' tab after submitting the form.
0
mobshopAuthor Commented:
Is this what you need? This was in the RAW tab in session inspector after posting.

HTTP/1.1 200 OK
Date: Fri, 01 Feb 2008 13:10:24 GMT
Server: Apache/2.2.0 (Fedora)
X-Powered-By: PHP/5.2.4
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 60
Connection: close
Content-Type: text/plain; charset=ISO-8859-1

ERROR: order_ref  - Order reference not specified
RESULT: 0
0
Marcus BointonCommented:
Ah. This could be a long-standing IE bug. Try doing this before you output your text:

header('Cache-Control: ');
header('Pragma:');

See comments at http://support.microsoft.com/kb/316431 and http://jspwiki.org/wiki/BugSSLAndIENoCacheBug

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Marcus BointonCommented:
Duh, I was in PHP mode there. You need to output or unset those HTTP headers before your content - I assume that there's either some similar header function in VFP or you can build your raw HTTP output.
0
mobshopAuthor Commented:
Ahhh at least it makes sense now. Thanks.

The confusing thing is why IE6 and Firefox have no problems doing the same thing. I read the explanation as to why IE7 needs to be able to cache the file before running it. Which makes sense, if a secure response is cached it would be available locally and therefore less secure. But how does IE6 and Firefox handle this issue?

This implies that there WAS a bug in both IE6 and FireFox that ignores the no-cache headers, but has since been 'fixed' in IE7? Sounds about right.

So would i be right in thinking that if i have no control over the response headers, i'm pretty much going to have to either use proper HTTP class in VFP or some other means to skirt round the problem?

0
Marcus BointonCommented:
The problem (and the reason that I consider this a bug, not a feature) is that it's only MS's lack of distinction between a cached item and a download that causes this problem; it's entirely possible to download a file without caching it. What's more, if I'm using it to download data that's live, I _really_ don't want it cached (i.e. the no-cache header correct meaning is the behaviour I actually need) - I might be able to "fix" IE to avoid the error, but it will be wrong when it hands the user the outdated locally cached version. Stupid MS.
I've had very mixed results in both IE6 and 7 with this bug, I've often had MS's supposed workaround not work. Most of those who report I ask to use firefox... IE is just a train wreck.
0
mobshopAuthor Commented:
Well i think you've adequeately explained why the problem is occuring, it's a lot clearer in my head now. We basically had to bite the bullet and ask one of our web guys to to spend some time and code in a workaround in PHP, then return the response to the browser using PHP instead of relying on the browser.

Thanks for all your help!
0
mobshopAuthor Commented:
Thanks again!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.