I have made a wordpress plugin for image crwaler but i have proplem in this code
so when i print $image i get this output https:// localhost/wordpress
there is a space after https://
i tryed str_replace but did not gone
i want the result https://localhost/wordpress
<?php
function image_url_filter($url) {
$url = str_replace('?ssl=1', '', $url);
$url = str_replace('https://', '', $url);
$url = str_replace('http://', '', $url);
$url = str_replace('//', '', $url);
$url = str_replace('http:', '', $url)
return "https://{$url}";
}
function get_chapter_images() {
include('simple_html_dom.php');
$url = 'http://localhost/wordpress/manga/manga-name-ain/chapter-4/';
$html = file_get_html($url);
$images_url = array();
foreach ($html->find('.page-break img') as $e) {
$image_links = $e->src;
array_push($images_url, image_url_filter($image_links));
}
//print_r($images_url);
return $images_url;
}
$images_links = get_chapter_images();
foreach ($images_links as $image) {
print_r($image);
}