Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Curl在*.aspx站点中搜索字符串的Shell脚本_Php_Bash_Shell_Curl_Raspbian - Fatal编程技术网

Php 使用Curl在*.aspx站点中搜索字符串的Shell脚本

Php 使用Curl在*.aspx站点中搜索字符串的Shell脚本,php,bash,shell,curl,raspbian,Php,Bash,Shell,Curl,Raspbian,我故意尝试编写一个简单的脚本,永久性地检查网站上的某个字符串,并在页面更新并包含该字符串后立即发送电子邮件 到目前为止,我已经完成了大部分任务,只是在我预定的网站上它不起作用。(不过对简单的也适用) 我想这可能与Cookies或JavaScript有关 这是我的密码: #!/bin/bash USERNAME="username" PASSWORD="passwd" URL="https://tickets.fcbayern.com/internetverkauf/EventList.aspx"

我故意尝试编写一个简单的脚本,永久性地检查网站上的某个字符串,并在页面更新并包含该字符串后立即发送电子邮件

到目前为止,我已经完成了大部分任务,只是在我预定的网站上它不起作用。(不过对简单的也适用)

我想这可能与Cookies或JavaScript有关

这是我的密码:

#!/bin/bash
USERNAME="username"
PASSWORD="passwd"
URL="https://tickets.fcbayern.com/internetverkauf/EventList.aspx"
#!/bin/bash
echo "before"
for (( ; ; ));
do
    count=`curl -s "https://tickets.fcbayern.com/internetverkauf/EventList.aspx" | grep -c "Ausverkauft"`
    if [ "$count" != "0" ]
    then
echo "Found Text"
        sendEmail -f $USERNAME -s smtp.gmail.com:587 \
            -xu $USERNAME -xp $PASSWORD -t $USERNAME \
            -o tls=yes -u "Web page changed" \
            -m "Visit it at $URL"
       sleep 5
    fi
    echo "ende"
done
目的是检查

  • 该网站包含“Ausverkauft”或“售罄”(英文版)
  • 然后发送电子邮件
  • 如果没有,请在5秒钟后重复检查
如果你能帮我,那就太棒了

在简单的站点上测试脚本效果很好


非常感谢

请定义“不起作用”。你有错误吗?只运行
curl时会得到什么https://tickets.fcbayern.com/internetverkauf/EventList.aspx“
?问题似乎是目标页面需要cookie或转发到其他页面。指定的问题是它找不到搜索字符串,因为在使用CURL时它会转发到另一个页面。背景是我想检查拜仁比赛的新门票何时上线。所以,如果我接受我收到的旋度输出:objectmoved Object moved to。