dtvx3420 2015-02-01 11:30
浏览 70

如何使用fopen而不是fsockopen

I'm using a PHP script to check for a PayPal Instant Payment Notification (IPN) and my hosting provider (1&1) doesn't allow the use of fsockopen() and pfsockopen(), but they do let you use fopen(). Here's the fsockopen code:

$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

I have tried other methods, such as putting in a replacement php.ini file, but they haven't worked. My question is how you would convert this statement to use fopen, giving the same result, e.g.

$fp = fopen(...);

Thanks!

  • 写回答

1条回答 默认 最新

  • dqmgjp5930 2015-02-01 11:52
    关注

    1&1 is big hoster and they probably blocked access to other sites, because too many users tried to DoS other servers with their 1&1 PHP scripts.

    First: Check if your web hosting got access to SSL sites:

    <?php
    echo file_get_contents('https://mail.google.com');
    

    When you open this script in your web browser, it should redirect you to gmail page. Error/white page = access to SSL (or all sites) is blocked.

    Second:

    Think about other paypal solution like 'notification' (turn off IPN on paypal site to make it work!). This method does not require any HTTP/SSL connection to any other server. Paypal just open your site after payment with information about who/when/how much paid. It's enough for most of websites. Example:

    At one page I made form that I send to paypal with attribute 'notify_url': https://github.com/gesior/Gesior2012/blob/TFS-1.0/pages/paypal.php

    At second page I made code that handles PayPal notifications about payments: https://github.com/gesior/Gesior2012/blob/TFS-1.0/pages/paypal_report.php

    [Paypal notify server got some specified IPs, so no one can fake notification]

    评论

报告相同问题?

悬赏问题

  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法