Giter VIP home page Giter VIP logo

Comments (15)

fooleap avatar fooleap commented on August 16, 2024

这可能是你的 PHP 配置是显示 Warning 。
我刚更新了 init.php 文件,忽略显示 Warning,可以覆盖下试试。

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

认证出错,使用那个邮箱和密码是可以登录进去,在网页上可以登录进去,然后也改了密码尝试。也不行,是不是需要disqus哪里配置什么呢

from disqus-php-api.

fooleap avatar fooleap commented on August 16, 2024

Disqus 那边应该没什么问题。还没折腾过 Docker,看起来有可能你的 Docker /tmp 目录不存在,或者没写的权限。

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

那可能是这个问题吧,不过使用了docker 搭建 php,上传文件是可以的,是不是可以说明有读写权限。

from disqus-php-api.

fooleap avatar fooleap commented on August 16, 2024

嗯,还可能会有另一个原因,就是你的 PHP 没有配置 cURL 扩展。

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

我试了下

<?php
// 使用 sys_get_temp_dir() 在目录里创建临时文件
$temp_file = tempnam(sys_get_temp_dir(), 'Tux');

echo $temp_file;
?>

可以创建文件的,是不是说明有权限,对了我的服务器在墙内。
好像发现问题了,我使用这段代码测试

<?php
  $ch = curl_init(); 
  //设置选项,包括URL
  curl_setopt($ch, CURLOPT_URL, "https://baidu.com");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  //执行并获取HTML文档内容
  $output = curl_exec($ch);
  //释放curl句柄
  curl_close($ch);
  //打印获得的数据
  print_r($output);
?>

Parse error: syntax error, unexpected '$ch' (T_VARIABLE) in /var/www/html/disqus/aa.php on line 2

from disqus-php-api.

fooleap avatar fooleap commented on August 16, 2024

权限应该没问题,可能是 cURL 的问题,找一下 php.ini 文件,看看 extension=php_curl.dll 是否被注释了。

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

经过多个测试,CURL 是有用的。

<?php
    //初始化
    $curl = curl_init();
    //设置抓取的url
    curl_setopt($curl, CURLOPT_URL, 'http://www.baidu.com');
    //设置头文件的信息作为数据流输出
    curl_setopt($curl, CURLOPT_HEADER, 1);
    //设置获取的信息以文件流的形式返回,而不是直接输出。
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    //执行命令
    $data = curl_exec($curl);
    //关闭URL请求
    curl_close($curl);
    //显示获得的数据
    print_r($data);
?>

然后我把api 部署到了一个虚拟主机里面,也是不行的

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

会不会是因为服务器在墙内的原因

from disqus-php-api.

fooleap avatar fooleap commented on August 16, 2024

当服务器在墙内时 config.php 的设置项 GFW_INSIDE 设为 true

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

from disqus-php-api.

fooleap avatar fooleap commented on August 16, 2024

@aimuz 我刚用阿里云国内虚机试了一下,确实是连不上的原因,最近网络环境差不少……

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

from disqus-php-api.

fooleap avatar fooleap commented on August 16, 2024

你可以试试,我目前部署在阿里云的香港 VPS 上面,一切正常。

from disqus-php-api.

aimuz avatar aimuz commented on August 16, 2024

部署在墙外OK了

from disqus-php-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.