[RESOLVED] PHP4 to 5 upgrade broke scripts...
I have had a problem with some scripts I wrote (Screenscrapers) that worked great in PHP4, but stopped working the minute I upgraded to PHP5.
I can change all of my filenames to have the .PHP4 extension and this solves the problem, but since this encompasses a number of sites, internal links and hundreds of files, this is not my first choice solution.
Here is the scraper, what it does, is it takes items from the zazzle Results Page by category, strips out the formatting, adds my affiliate ID and then I can present these items on my page.
This works find in PHP4; not at all in PHP5.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test of scrape</title>
<link rel="stylesheet" type="text/css" href="/css/scraper.css" />
<div class="gridCell " id="page_productsGrid_assetCell1">
$page = file_get_contents("http://www.zazzle.com/cool+smiley+gifts");
//comment out the <span> tags completely
$page = preg_replace('/<span/', "<!-- <span", $page);
$page = preg_replace('/<\/span>/', "<\/span> -->", $page);
$page = preg_replace('/<a /', "<a rel=\"nofollow\" ", $page);
// Regular expression to parse "&rf=" and the $rf_id into the existing link
$test = explode('<div style="position:relative" class="clearfix">',$page);
print "<div class=\"gridCellInfo\" id=\"page_products\">";
My ideal solution would be an .htaccess file that I could put in any directory under PHP5 to make it default to php4.
I have tried this, to no avail (.htaccess):
I have also tried a few alternatives... this appears to be a common problem and I have scoured the web and found no solution.
AddType text/html .php4
AddHandler php4-script .php .html php5
Here are the two pages in PHP4 and PHP5:
Last edited by donatello; 02-25-2011 at 06:22 AM.
Reason: Added the hyperlinks to the php4 and php5 test pages
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread