<?php
$filename = "/path/to/file.rpm";
// open file
$rpmr = rpm_open($filename);
// get "Name" tag
$name = rpm_get_tag($rpmr, RPMREADER_NAME);
// get "Version" tag
$ver = rpm_get_tag($rpmr, RPMREADER_VERSION);
// get "Release" tag
$rel = rpm_get_tag($rpmr, RPMREADER_RELEASE);
echo "$name-$ver-$rel<br>\n";
// close file
rpm_close($rpmr);
?>