php - 跟踪像素和 Gmail 代理的问题

标签 php email proxy gmail event-tracking

我正在尝试为从 wordpress 发出的电子邮件实现自定义跟踪像素。

感谢这些帖子:

Tracking email with PHP and image

Tracking email opens with a real image

尤其是

http://www.phpdevtips.com/2013/06/email-open-tracking-with-php-and-mysql/

我能够实现核心思想。

电子邮件通过以下方式加载跟踪像素 <img src="https://www.example.com/tracking.php?order_id=1" width="100" height="100" />

并在 tracking.php 中

$graphic_http =  'https://www.example.com/GIF-example.gif';

header('Content-Type: image/gif');
readfile( $graphic_http );

在浏览器中打开 tracking.php 文件会打开 gif 图像以供下载。

但是,跟踪像素/跟踪图像不会显示在 Gmail 电子邮件中。只有损坏的图像 Logo ,当我单击以显示图像时,此链接已打开

https://ci5.googleusercontent.com/proxy/l2xUKFGnNFKm64zEYmJhOcUmEJm15w9MC1txRRF01tpKlcL3t3O16aMJgbYQkucBySV0xV2T0EsCwikOAC0Z4em6uPzSs38lkHrYBvosRRAk14EfPoEXqC5JdLxRm8ToZmGSQqt_RwHCaBE_3uLgQDVEB05Rdtkq-Xzuw30=s0-d-e1-ft#https://www.example.com/tracking.php?order_id=1

其中指出 Google 404:

Google 404。这是一个错误。

The requested URL/proxy/l2xUKFGnNFKm64zEYmJhOcUmEJm15w9MC1txRRF01tpKlcL3t3O16aMJgbYQkucBySV0xV2T0EsCwikOAC0Z4em6uPzSs38lkHrYBvosRRAk14EfPoEXqC5JdLxRm8ToZmGSQqt_RwHCaBE_3uLgQDVEB05Rdtkq-Xzuw30=s0-d-e1-ft was not found on this server.我们知道的就这些。

看来是Google的代理无法读取php脚本的问题。 tracking.php 和 GIF-example.gif 文件都拥有 775 权限并且可以公开访问。

在 Hotmail 上这确实有效,所以这似乎确实是 Google 代理的问题。

有人知道如何让 Google 代理访问此跟踪像素吗?

最佳答案

我找到了答案:问题出在 Google 代理和问号上?在 https://www.example.com/tracking.php?order_id=1

Google 代理地址被弄乱了,因为它已经有一个问号并导致 404。

我使用 https://www.example.com/tracking.php/order_id=1 解决了它,然后在 tracking.php 上我没有使用 $_GET$_SERVER['REQUEST_URI'] 并解析了 /order_id= 字符串。

跟踪像素显示在 Gmail 中,并在 tracking.php 脚本中进行跟踪。

关于php - 跟踪像素和 Gmail 代理的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38226003/

相关文章:

python - 通过代理的 DNS?

java - 在代理后面使用 axis2 Web 服务时出现问题

php - 我只想通过编写 Eloquent $query 作用域函数来获取第一个表的数据

PHP , MySQL 和 SSL 认证

php - 如何复制位于另一台服务器上的文本文件

ssh - 通过socks代理的DNS。如何更改域解析的 Windows 设置。

php - HostGator 不会通过 PHP SwiftMail API 发送邮件

xml - Haskell RSS、邮件和 XML 库选择

email - 电子邮件中可以安全使用的最大 URL 长度是多少?

php - 将电子邮件副本发送给发件人 PHP 联系脚本