0

I'm trying to get the title of a couple Android applications. Here's an example of my code I am using:

<?php

// Create DOM from URL or file
$package_name = 'com.brogent.livewallpaper.halloween';
include('simple_html_dom.php');
$html = new simple_html_dom();
$html -> load_file("http://play.google.com/store/apps/details?id='$package_name'");

$det[0][1] = $html->find('h1[class=doc-banner-title]');
echo $det[1];
?>

The problem I am having is that THIS is what my browser is showing me whenever I load the script in a php file:

load_file("http://play.google.com/store/apps/details?id='$package_name'"); $det[0][1] = $html->find('h1[class=doc-banner-title]'); echo $det[1]; ?>

So, what do I need to do to fix this issue so I can get the output I need, get the quick info I need, and get on my way?

Jerome
  • 172
  • 2
  • 10

2 Answers2

0

your web server was not configured correctly. Make sure that your web server can interpret php correctly. You need install php module with apache.

pensz
  • 1,871
  • 1
  • 13
  • 18
  • PHP is installed, Apache 2.0 is installed, I've had this server running for over 2 years without any issues with PHP. `PHP Version 5.2.17 Apache Version Apache Apache API Version 20051115` – Jerome Dec 02 '12 at 12:42
0

You need to enable the PHP interpreter for your server and/or have the correct extension.

For Apache you need to install PHP and add the following lines to httpd.conf:

LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/Program Files/PHP"

Replacing the paths as appropriate

Also may need to change this line to read DirectoryIndex index.php index.html index.htm

EDIT

Double check

  1. That the extension to the file is .php
  2. That you have <?php at the start of the code and ?> at the end (or one of the other ways to start the PHP interpreter.
  3. If using XML check that the string does to contain <? or >? for the first line of XML.
Ed Heal
  • 59,252
  • 17
  • 87
  • 127
  • everything is loaded properly, my script is being tested on a live production server that's running about 30 websites as we speak. – Jerome Dec 02 '12 at 12:48
  • @seth - It is just polite and marks the end of code. The sequence of characters can occur in XML files and if the PHP code is generating XML you need to ensure that those sequence characters do not occur. Also some IDEs use this marker. – Ed Heal Dec 02 '12 at 13:13
  • The actual page being loaded is in the code i provided,above. It loads a "normal" web page,and is supposed to find the h1 tag with class doc-banner-title. My server is a managed dedicated server,so should i ask them to check for proper handlers? Php short tags is enabled,im running php5 and not sure what else to do here.the file extension of the file is .php, in fact,the filename is literally test.php. Also,sorry for bad formatting in this reply,my tablet doesnt like to correct my input on SO. My code,above,is the exact code im trying to use. It seems that something goes wrong at the -> part. – Jerome Dec 02 '12 at 18:38