Triggering url.

本文介绍如何利用wget工具静默加载指定网址的内容,并确保所有输出(包括错误信息)都被忽略,适用于自动化任务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

* * * * * wget -O - http://yoursite.com/tasks.php >/dev/null 2>&1

That should work for you. Just have a wget script that loads the page.

Using -O - means that the output of the web request will be sent to STDOUT (standard output)

by adding >/dev/null we instruct standard output to be redirect to a black hole. by adding 2>&1 we instruct STDERR (errors) to also be sent to STDOUT, and thus all output will be sent to a blackhole. (so it will load the website, but never write a file anywhere)

// ==UserScript== // @name Request Trigger Script // @namespace http://tampermonkey.net/ // @version 2025-03-25 // @description Trigger actions when specific requests are made // @author You // @match https://*/* // @grant none // ==/UserScript== (function () { 'use strict'; // 配置目标域名和触发条件 const CONFIG = { TARGET_DOMAINS: [ "nvne.spoken.fun", "nytw.chester.run", "bwxm.chester.run" ], TRIGGER_KEYWORD: "/api/data" // 请求 URL 中包含的关键字 }; // 日志工具 const logger = { info: (...args) => console.log('[Request Trigger]', ...args), error: (...args) => console.error('[Request Trigger]', ...args) }; // 检查是否为目标请求 const isTargetRequest = (url) => { return CONFIG.TARGET_DOMAINS.some(domain => url.includes(domain)) && url.includes(CONFIG.TRIGGER_KEYWORD); }; // 拦截 XMLHttpRequest const interceptXhr = () => { const originalOpen = XMLHttpRequest.prototype.open; const originalSend = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.open = function (method, url, ...rest) { this._isTarget = isTargetRequest(url); if (this._isTarget) { logger.info('Intercepted XHR request:', method, url); } return originalOpen.apply(this, [method, url, ...rest]); }; XMLHttpRequest.prototype.send = function (body) { if (this._isTarget) { logger.info('Triggering action for XHR request:', this._url); triggerAction(this._url, body); } return originalSend.apply(this, arguments); }; }; // 拦截 fetch 请求 const interceptFetch = () => { const originalFetch = window.fetch; window.fetch = async function (input, init) { const url = typeof input === 'string' ? input : input.url; if (isTargetRequest(url)
最新发布
03-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值