writing a screen scraper


Posted on 16th Feb 2014 07:03 pm by admin

Hello,

I'm writing a screen scraper application and want to be able to get absolute addresses for images from relative links.

So a link like this: Code: <img src="../e-commerce_in_a_box_small.jpg" alt="E-Commerce" width="100" height="134" border="0" /> might link to http://www.myointernational.com/furniture/e-commerce_in_a_box_small.jpg

If I am analysing a web address, I understand that the pseudo code would be something like this:Code: <?php

$string='<img src="../../e-commerce_in_a_box_small.jpg" alt="E-Commerce" width="100" height="134" border="0" />';
// we need to find the system root and replace the ../ with REAL values.

$url='http://www.myointernational.com/test_dir/';
if($string contains '../'){
$number_of_them=count(the number of them);
}
$i=1
while($i<=$number_of_them){
$tmp_url=go up one level from the $url;
$i++;
}
?>
<img src="<?php echo $tmp_url;?>" alt="E-Commerce" width="100" height="134" border="0" />
How would I go about finding the code to make the pseudo code work?

252 Like 22 Dislike
Previous php-forum Next php-forum
Other php-forum

MASS PM
Hello all, I'm trying to send mass private messages to users in my database but keep getting an erro

Anti Spam Code
Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I

Exporting new records
Trying to figure out the best way to set this up.

People register my site.

Their prof

Check if another session of the page is running?
I want to keep people from opening multiple tabs, or sessions of my Facebook app. Is it possible to

Setting condidtions for an input box
Hi all,

I would like to set a condition in a txt box that says the number a user enters has t

sendmail code suddenly not working
Hi Guys, I maintain 3 sites (including my own) I use the following code from a french webmaster that

$get problem
Hi Guys ...

can you please tell me what i am doing wrong here
Code: <?php

multipart emiail forms
Hi All,

I am new to the boards and I've been working on a form (which is rather massive, imo

Text file to .Dat file Conversion in PHP
Hi All,
Could anybody provide code for Text file to .Dat file Conversion in PHP.

Tha

problem with php mysql query
Hi guy's...

I'm totally lost here..because don't have any idea how to make a query for grab r

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash