AbRUPT
Hochschule RheinMain

Automated Reasoning for Web Usability Problems

Example to Access a Service with PHP

// URL and language option
$url = "http://wba.cs.hs-rm.de/AbRUPt/service/readability/";
$lang = "en";
$text = "Text to be analyzed.";

// initialize curl 
$ch = curl_init();
// set options of post request
curl_setopt($ch, CURLOPT_URL, $url.'?lang='.$lang);  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
// set post body
curl_setopt($ch, CURLOPT_POSTFIELDS, $text);
// execute rest query and check HTTP state
$output = curl_exec($ch);
$state = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// close curl channel
curl_close($ch);