小编Vim*_*ath的帖子

Slack PHP API - 避免超时错误

我正在尝试使用Slack Custom命令,并且不太确定如何使用延迟消息,因为Yoda Speak External API需要3秒以上的响应时间.

我做了以下事情:

  • /Yoda在我的情况下发送了slack命令并收到了reponse_url.
  • post对响应URL 使用以下内容.
$data_string = '{"response_type": "in_channel", "text":"Checking,please wait..."}' ;
$chs = curl_init();
curl_setopt($chs, CURLOPT_URL, $response_url);
curl_setopt($chs, CURLOPT_POST, true);
curl_setopt($chs, CURLOPT_POSTFIELDS, $data_string); 
curl_setopt($chs, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($chs, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($chs, CURLOPT_RETURNTRANSFER, true);
curl_setopt($chs, CURLOPT_POST, 1);
curl_setopt($chs, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$results = curl_exec($chs);
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • 现在,当我调用Yoda API时,它会出现以下错误"已达到超时".我读到延迟回复,但不知道我应该怎样从这里开始.
$chsres = curl_init();
curl_setopt($chsres, CURLOPT_URL, "https://yoda.p.mashape.com/yoda?sentence=welcome+to+stack");
curl_setopt($chsres, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($chsres, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($chsres, CURLOPT_VERBOSE, true);
curl_setopt($chsres, CURLOPT_TIMEOUT, 45);
curl_setopt($chsres, CURLOPT_RETURNTRANSFER, true);
curl_setopt($chsres, CURLOPT_HTTPHEADER, array('Content-Type:application/json', "X-Mashape-Key:> …
Run Code Online (Sandbox Code Playgroud)

php curl timeout slack-api slack

10
推荐指数
1
解决办法
4283
查看次数

查找本月的第二个和第四个星期六

如何找到本月的第2和第4个星期六.我写了这些文字: -

echo "may 2nd sat ".date('d', strtotime('may 2013 second saturday'));
echo '<br/>may 4th sat '.date('d', strtotime('may 2013 fourth saturday'));                                  
echo '<br/>june 2nd sat '.date('d', strtotime('june 2013 second saturday'));
echo '<br/>june 4th sat '.date('d', strtotime('june 2013 fourth saturday'));
Run Code Online (Sandbox Code Playgroud)

它给出了以下输出: -

may 2nd sat 11
may 4th sat 25
june 2nd sat 15
june 4th sat 29
Run Code Online (Sandbox Code Playgroud)

它在may月份给出正确的答案, 但不是june 2013,在jun 1013第二和第四个星期六分别应该是8和22.我怎么能解决这个问题.

php datetime php-5.4

7
推荐指数
1
解决办法
9202
查看次数

添加15分钟到当前时间并按15分钟间隔

我需要在当前时间增加15分钟.例如:现在是 20:48,需要添加15分钟,所以现在它将是21:03,但我需要设置21:15,也就是说,它应该是的倍数15,30,45,00.帮助/指导将有很大帮助.

<?php
$current_date_time = date('d/m/Y H:i:s');
$current_date = date("d/m/Y H:i", strtotime($current_date_time."+15 minutes"));
echo $current_date;exit;
Run Code Online (Sandbox Code Playgroud)

php datetime

5
推荐指数
1
解决办法
4814
查看次数

阻止来自搜索引擎的网站 - DuckDuckGo

我有一个开发网站https://text-domain.com.(不是真实的网站)当我访问https://duckduckgo.com并搜索text-domain.com时,它会返回结果.

到目前为止我尝试了什么:

robots.txt使用以下代码创建文件(放在我的根目录中,即在text-domain.com/robots.txt中):

User-agent: *
Disallow: /
Run Code Online (Sandbox Code Playgroud)

然后在我的模板文件中添加了这样的元标记:

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
Run Code Online (Sandbox Code Playgroud)

即便在这样做之后,我搜索了DuckDuckGo并得出了相同的结果.欢迎大家提出意见.

PS

嗨,等了几天后有2个发现:

  • 仍然,搜索结果被提取.
  • 但是我看到一条消息说:"我们想在这里向您展示一个描述,但该网站不允许我们."

    是否有可能完全阻止在结果中显示?

robots.txt robot web-crawler duckduckgo

4
推荐指数
2
解决办法
1万
查看次数