正则php咨询
最近想用PHP写一个收集站内网址列表的程序,如果要是为每个独立的网站都配置单独的规则程序就显得不够智能,所以想一次性写一个智能点的,我的思路是,程序从一个入口进入“www.xxx.com”后用FILE_GET_CONTENT 或CURL获取该页的HTML,然后通过正则分析出所有的链接保存到数组中。
这个时候问题就出现了,因为HTML写法问题,会出现很多情况,下面举例说明。
标题
标题
标题
标题
标题
标题
标题
等等吧,还有很多情况就不逐一写出来了,由于FILE_GET_CONTENT是必须能够访问到该页面才可以返回HTML,但是如果在访问之前不处理的话,就会出现无法访问被跳过的现象,于是我就根据一定情况对上述地址进行拼接使其能够被访问到。
但是我写出的程序依旧不能解决所有问题,而且现在会出现程序没执行完毕就停了,程序不报任何错误,好像结束了一样。
想赖咨询一下,大家有没有什么好的方法去匹配所有情况,因为网址拼接这块是个重点,如果不能有效拼接就无法抓取更多网址,但是通常的拼接不能解决所有情况。
希望大家给予指导。

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 English version
Recommended: Win version, supports code prompts!

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools