Undefined index: HTTP_ACCEPT

Installing and configuring Tera-WURFL on your server.

Undefined index: HTTP_ACCEPT

Postby emaillenin » Thu Feb 03, 2011 8:06 am

I am having a download link to an image. When a user clicks this, he will be readirected to page, where I have used PHP readfile function and force download to the user. But this is what is getting downloaded instead of the image.

<br />
<b>Notice</b>: Undefined index: HTTP_ACCEPT in <b>/home2/public_html/library/Tera-WURFL/WurflSupport.php</b> on line <b>63</b><br />
<br />
<b>Fatal error</b>: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in /home2/public_html/library/Tera-WURFL/WurflSupport.php, line 63' in /home2/public_html/Zend/library/Zend/Controller/Response/Abstract.php:321
emaillenin
 
Posts: 5
Joined: Thu Feb 03, 2011 7:50 am

Re: Undefined index: HTTP_ACCEPT

Postby kamermans » Fri Feb 04, 2011 2:11 pm

Hi! The first problem is that the device/browser you are using is not sending an HTTP_ACCEPT field in it's HTTP Request - this is not a show-stopper, which is why a "NOTICE" level error is shown. The second problem is that Zend is throwing an exception because it can't redirect the user after something has been sent to the browser. In this case, the NOTICE error is being sent to the browser and that is what is killing your script. To fix this, make sure you always block error messages in your file download scripts - even if it did work the file would have the error message at the top of it, which is not what you want. To block all but unrecoverable errors, put this at the top of your PHP script:

Code: Select all
error_reporting(E_ERROR);
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX

Re: Undefined index: HTTP_ACCEPT

Postby emaillenin » Fri Feb 04, 2011 2:39 pm

Thanks for the reply, admin ;) I'll try to fix it.
emaillenin
 
Posts: 5
Joined: Thu Feb 03, 2011 7:50 am

Re: Undefined index: HTTP_ACCEPT

Postby kamermans » Fri Feb 04, 2011 2:58 pm

No problem, let me know if you have any more issues!
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX


Return to Installation / Configuration

Who is online

Users browsing this forum: No registered users and 6 guests