PHP Client
ACHTUNG: Bitte berücksichtigen Sie, dass die Inhalte, die Sie via API beziehen und veröffentlichen, mit den Originalmeldungen im Presseportal verlinkt werden müssen. (Mehr)
PHP API-Client
Requirements
PHP > 5.2 (without using json PHP > 5.1)
Download
Presseportal.class.php (Version 0.2, 6.5.2011)
Usage example
require('Presseportal.class.php');
$pp = new Presseportal($api_key, 'de');
$pp->format = 'json';
$pp->limit = '5';
// this will return the newest 5 stories with videos in "Vermischtes"
$response = $pp->get_ressort_articles('vermischtes', 'video');
if(!$response->error) {
foreach($response->stories AS $story) {
echo '<a href="'.$story->url.'">'.$story->title.'</a><br/>';
}
} else {
echo $response->error_msg;
}
// search for public service offices with "hessen" in name, limit is 18
$response = $pp->search_office('hessen',18);
if(!$response->error) {
foreach($response->hits AS $hit) {
echo '<a href="'.$hit->url.'">'.$hit->name.'</a><br/>';
}
} else {
echo $response->error_msg;
}
Other Methods
// returns all new articles in sector "It/Computer"
$pp->get_branche_articles('computer', false);
// return articles for keyword(s)
$pp->get_keyword_articles('auto,fussball')
// gets the latest public service news in Niedersachsen (ni) with images
$pp->get_publicservice_articles('ni', 'image');
// searches for companies with "news" in name, limit results to 3
$pp->search_company('news',3);
// get the latest stories with image attachments, making a json request
$pp->get_articles('image', false,'json');
// get latest 5 stories with images for the company with the id 6344
$pp->get_company_articles(6344, 'image', 5);
// get latest 5 stories with images for the company with the id 6344
$pp->get_company_articles(6344, 'image', 5);
// gets 10 ir adhoc news, starting with an offset of 5, with teasers only
$pp->get_ir_articles('easy_adhoc', 5, 10, true)
// gets ir voting right news for the compayn with the id 31522
$pp->get_ir_company_articles( 'easy_vote', 31522);
// get extented informations about the public service office with the id 6337
$pp->get_office_info(6337);
// get extented informations about the company with the id 6344
$pp->get_company_info(6344);
// get extented informations about the attachment with the id 6344
$pp->get_media_info(132165);
Proxy Support
$pp->set_proxy('http://proxy.example.com',8080);
