Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get the href in string regex php

$html = 'some text here<a href="http://www.mydomain.com/page.html">URL</a> some text here as well';

$url = preg_match('/<a href="(.+)">/', $html, $match);

$info = parse_url($match[1]);

echo $info['scheme'].'://'.$info['host'];
Comment

PREVIOUS NEXT
Code Example
Php :: php right characters 
Php :: php artisan make:request 
Php :: debug query in moodle 
Php :: php mysql datetime format string 
Php :: ubuntu php7.4-curl : Depends: libcurl3 (= 7.44.0) but it is not going to be installed E: Unable to correct problems, you have held broken packages. 
Php :: php extract zip 
Php :: return redirect with message laravel 
Php :: strupper php 
Php :: symfony exclude class from autowiring 
Php :: laravel get host with http 
Php :: php url parse 
Php :: validate timestamp php 
Php :: how check if variable is resgister in laravel 
Php :: php kril to eng 
Php :: laravel faker boolean 
Php :: transaction cakephp 2 
Php :: php remove space before and after string 
Php :: sudo apt-get install php7.0-gd 
Php :: php parse json 
Php :: php get ip by domain 
Php :: shoulder blade technical name 
Php :: php error display 
Php :: disable SSL check in PHP cURL 
Php :: PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; 
Php :: php curl ssl certificate problem 
Php :: laravel collection implode 
Php :: pdo fetchall as object 
Php :: laravel mail success or failure 
Php :: laravel get authorization bearer token 
Php :: image watermark on image laravel 8 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =