I have tried the following code on localhost and it works perfectly but when I upload it to our ftp account (server) I got blank pages!!
So is the problem with my code or is it the server???? here is the code:
<?php
echo "<HTML DIR=\"RTL\">";
echo "<META http-equiv=Content-Type content=\"text/html; charset=utf-8\">";
$handle = fopen("http://www.tadawul.com.sa/wps/portal/!ut/p/.cmd/cs/.ce/7_0_A/.s/7_0_4IT/_s.7_0_A/7_0_4IT", "r");
$contents = '';
if($handle)
{
while (!feof($handle)) {
$contents = fread($handle, 100000);
}
fclose($handle);
$contents = preg_replace('/<A id [>]+>(.*?)<\/A>/i', "$1", $contents);
//a unique string before the target data
$before='<TR class="title_market">';
//a unique string after the target data
$after = '</DIV>';
//finding the beginning of the target data
$contents = explode($_before,$contents);
//finding the end of the target data
$myData = explode($_after,$contents[1]);
// display the data
echo "<table> $_before $myData[0] </TABLE>";
} //end if
echo "</HTML>";
?>
Please help!!