Dann führe ich den Monolog hier mal weiter …
Das hier funktinoiert jetzt, aber ich habe jetzt schon vieles versucht (str_replace, trim, strip_tags usw.)
Was muss ich tun um die ersten gefundenen Kennzeichen der Ausgabe auszuwerten?
Egal was ich mache, ich habe immer noch Haufenweise Leerzeichen oder Zeilenumbrüche im Ergebnis.
Habt ihr eine Idee dazu?
<?php
$startseite="https://apps.kdo.de/wuakz/app?kdnr=4000";
$cookie = tempnam ("/tmp", "CURLCOOKIE");
//cookie holen, in $cookie speichern
$ch = curl_init ($startseite);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt($ch, CURLOPT_REFERER, "https://apps.kdo.de/wuakz/app?");
//curl_exec ($ch);
//ausführen
$content = curl_exec ($ch);
//Info
$response = curl_getinfo( $ch );
//Pfad extrahieren
$pfad = str_replace("Suchen","Auswahl",$response['redirect_url']);
//echo $pfad;
//POST-Daten setzen
$post[] = urlencode('service').'='.urlencode('direct/1/Suchen/border.$Form');
$post[] = urlencode('sp').'='.urlencode('S0');
$post[] = urlencode('Form0').'='.urlencode('$RadioGroup,$RadioGroup$2,$Checkbox,inputBuchstaben,inputZiffern,$FormConditional,$FormConditional$0,$FormConditional$1,$ImageSubmit,$FormConditional$2');
$post[] = urlencode('$FormConditional').'='.urlencode('F');
$post[] = urlencode('$FormConditional$0').'='.urlencode('T');
$post[] = urlencode('$FormConditional$1').'='.urlencode('T');
$post[] = urlencode('$FormConditional$2').'='.urlencode('F');
$post[] = urlencode('$RadioGroup').'='.urlencode('0');
$post[] = urlencode('$RadioGroup$2').'='.urlencode('0');
$post[] = urlencode('$ImageSubmit.x').'='.urlencode('35');
$post[] = urlencode('$ImageSubmit.y').'='.urlencode('14');
$post[] = urlencode('inputBuchstaben').'='.urlencode('JJ');
$post[] = urlencode('inputZiffern').'='.urlencode('*');
$post = implode('&', $post);
//echo $post;
//Suchanfrage abschicken
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
curl_setopt($ch, CURLOPT_URL, 'https://apps.kdo.de/wuakz/app?');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$ergebnis = curl_exec ($ch);
//echo $ergebnis;
//Ergebnis abrufen
$auswahl = "https://apps.kdo.de/wuakz/app?service=page/Auswahl";
$ch = curl_init ($auswahl);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
$output = curl_exec ($ch);
echo $output;
?>
Gruß
Jens