Göreli yol resmi Kazıma

2 Cevap php

Ben ekran bir site (http://website.com) kazıma ile biraz yardıma ihtiyacım var.

Lets say I'm trying to get an image inside <div id="imageHolder"> But when I pull it down, it's path is relative ie "image_large/imageName.jpg" (I'm going to pull down this image daily as it changes daily. It always begins with "images_large/.

Nasıl gitmek ve içeride o görüntüye website.com url Önlerine <div id="imageHolder">?

2 Cevap

$url = 'http://www.website.com/';

// screen scraping here

// say you have your image you scraped stored in the variable below
$img = 'images_large/imageName.jpg';

// your new full path to the image
$fullpath = $url . $img;

// test it (just to see for yourself)
echo $fullpath;

Bu sadece sizin kazınarak URL üzerine göreli görüntü yolunu eklemek için PHP'nin birleştirme operatörü, . temel kullanımı, yapıyor.

Verileri hurdaya sonra, u "http://website.com/image_large/" ile "/ image_large" yerine str_replace kullanabilirsiniz ... bence basit şu

Bu html tüm benzer görüntü yolları yerini alacak .. ya u sadece tek bir resim istiyorsanız, ben başka bir kullanıcı için ua çözüm vermiştir düşünüyorum. bence o herhangi bir basit almaz.