I'm not using fopen anymore. The datafeed exists and the permissions are 644.
Sometimes I do get output but it isn't complete. When I do get output this is what it looks like:
4
Conn
What is going on here?? I thought this project would be so easy...
Here is the code I'm using now.
$local_file="/var/www/html/admin/datafeeds/6040.txt";
/
$readfile=fopen($local_file,"r");
$data = fread($readfile, 10000000);
/
$data=file_get_contents($local_file,false);
echo "something";
$data=str_replace("\r\n","\n",$data);
/
$array_rows=explode("\n",$data);
$rows_count=count($array_rows);
echo "rows count is $rows_count<BR><BR>";
/
//echo $data;
$data=str_replace("\n","|",$data);
echo "Data is:<BR><BR> $data";
/*
$array_tabs=explode("|",$data);
$tabs_count=count($array_tabs);
//make sure the report is complete first by seeing if it has a totals row at the end
$x=0;
$rows="";
while ($x < $tabs_count) {
$rows.="<tr>";
$sku = $array_tabs[$x];
$rows.="<td>$sku</td>";
$x++;
$name = $array_tabs[$x];
$rows.="<td>$name</td>";
$x++;
$product_url = $array_tabs[$x];
$rows.="<td>$product_url</td>";
$x++;
$price = $array_tabs[$x];
$rows.="<td>$price</td>";
$x++;
$retail_price = $array_tabs[$x];
$rows.="<td>$retail_price</td>";
$x++;
$url_to_image = $array_tabs[$x];
$rows.="<td>$url_to_image</td>";
$x++;
$url_to_thumbnail_image = $array_tabs[$x];
$rows.="<td>$url_to_thumbnail_image</td>";
$x++;
$commission = $array_tabs[$x];
$rows.="<td>$commission</td>";
$x++;
$category = $array_tabs[$x];
$rows.="<td>$category</td>";
$x++;
$subcategory = $array_tabs[$x];
$rows.="<td>$subcategory</td>";
$x++;
$description = $array_tabs[$x];
$rows.="<td>$description</td>";
$x++;
$searchterms = $array_tabs[$x];
$rows.="<td>$searchterms</td>";
$x++;
$status = $array_tabs[$x];
$rows.="<td>$status</td>";
$x++;
$merchant_id = $array_tabs[$x];
$rows.="<td>$merchant_id</td>";
$x++;
$custom_1 = $array_tabs[$x];
$rows.="<td>$custom_1</td>";
$x++;
$rows.="</tr>";
} //while
*/
echo "<p>Here is the data that was imported into the database:</p><table>$rows</table>";