Help with basic php and xml needed

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2011-01-17T22:51:41Z Indexed on 2011/01/17 22:53 UTC
Read the original article Hit count: 178

Filed under:
|
|

Hi, I'm really new to xml, with this being my first dip into it.

I'm trying to add some text to an image using php and xml.

I keep getting the following error: Parse error: syntax error, unexpected '}' in /home/a8744502/public_html/userbar.php on line 18

Below is my code.

<?php
header ("Content-type: image/jpeg");

$doc = new DOMDocument();
$doc->load( "http://phogue.net/feed/". LIBXML_DTDLOAD );

$procon = $doc->getElementsByTagName( "procon" );

$packages = $procon->getElementsByTagName( "package" );
$value = 0;

foreach($packages as $package)
{
  $downloadsA = $package->getElementsByTagName( "downloads" );
  $downloads = $downloadsA->item(0)->nodeValue;

  $value = $downloads + $value
}                                           
$font  = "visitor1.tff";
$font  = 4;
$im = ImageCreateFromjpeg("procon_plugindeveloper.jpg");
$x = 360;
$y = 0;
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 255, 255, 255);
imagestring ($im, $font, $x, $y,  $value, $text_color);
imagejpeg ($im);
?>

The xml file is of the form

<procon>
-<packages>
--<package>
---<downloads>
---</doanloads>
--</package>

--<package>
---<downloads>
---</doanloads>
--</package>

--<package>
---<downloads>
---</doanloads>
--</package>


-</packages>
</procon>

The idea is that it should print out the sum of all the downloads tags that are contained in .

Any help is appreciated :-)

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml