mi-home | С # API for Xiaomi Mi Home devices
kandi X-RAY | mi-home Summary
kandi X-RAY | mi-home Summary
С# API for Xiaomi Mi Home devices
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mi-home
mi-home Key Features
mi-home Examples and Code Snippets
Community Discussions
Trending Discussions on mi-home
QUESTION
I'm looking for a solution to extract only one URL from a specific webpage using PHP.
Here's a simple example of what I need:- I have a URL with many links (https://apkpure.com/mi-home/com.xiaomi.smarthome/download?from=details)
- I want to scrape the link under the anchor
click here
from the current page. - Then the code must return this result
https://download.apkpure.com/b/XAPK/Y29tLnhpYW9taS5zbWFydGhvbWVfNjMwNjdfYWU1M2FmOWU?_fn=TWkgSG9tZV92NS44LjdfYXBrcHVyZS5jb20ueGFwaw&as=4c5e64f6f957edac834f3631fe4e09715f2e35f6&ai=-1070628217&at=1596863870&_sa=ai%2Cat&k=24cb20f95fbf333deb01c145ce7b982b5f30d87e&_p=Y29tLnhpYW9taS5zbWFydGhvbWU&c=1%7CLIFESTYLE%7CZGV2PVhpYW9taSUyMEluYy4mdD14YXBrJnM9MTI5OTAzMTM4JnZuPTUuOC43JnZjPTYzMDY3
.
ANSWER
Answered 2020-Aug-08 at 09:27If you look at the required URL, you can see it has a pattern https://download.apkpure.com
at start of each Click Here URL
, so, we can use regex to find it.
preg_match_all
will return an array of strings that will match our regex. Then I have used implode to convert the first index to a string.
Here is the complete working code:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mi-home
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page