Looking at the source code of this website:


http://superdialcouk.dmshop.biz/numbers/0207/choose.php?dmb1_SessRef=2009-08-22_15-29-14_8068_0003

What code do i copy and paste to get that table of telephone numbers on my website, the numbers need to remain dynamic in thesense tat if theyre purchased from the site given above - they then should not be viewable on my site.

Recommended Answers

All 3 Replies

Well to retrieve the entire page use file_get_contents() then preg_match_all() to filter to that table. Below is an example

<?
$var=file_get_contents('http://superdialcouk.dmshop.biz/numbers/0207/choose.php?dmb1_SessRef=2009-08-22_15-29-14_8068_0003');
$var=preg_match_all('/<table class="vert_centered_leaded" style="width: 100%;".*<tr>.*<tr>.*<\/tr>(.*<\/table>)/Us',$var,$array);
//print_r($array);
$var='<table class="vert_centered_leaded" style="width: 100%;">'.$array[1][0];
unset($array);
echo $var;
?>

Usually I only use curl if it involves pinging or posting to a server.

commented: code is much appreciated, sorry for the late feedback +0

fopen

If PHP has decided that filename specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that allow_url_fopen is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail.

Also if someone gets wary of the ip address that the request is being made from your server ip could get blacklisted. with curl you can change the headers being sent to mirror googlebot or what not. Then none would be the wiser.

commented: thanks for the info, sorry a very late reply +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.