RSS FEED via proxy

MMMEC

Grünschnabel
Hallo

Ich habe folgendes Problem ich will einen RSS FEED via PHP auf meine Homepage einabauen. Das Problem ist hinter meinem System hängt ein Proxy server. Der es verhindert das ich die RSS/XML Datei mit Fopen öffnen kann. Nach langer suche habe ich eine paar scripte gefunden die evtl. funktionieren könnten tun sie aber nicht.

Jetzt meine Frage an euch wie krieg ich den RSS FEED trotz Proxies zum laufen.

Als XML PRaser nutze ich ein Script von Stefan Fischer.

Mein PLan ist es mit diesem Script die Datei auszugeben und das ergebniss an den XML Praser zu übergeben.

Code:
<?php

/* http_connect_example.php

* This is an example of how you can connect to 

* a remote HTTP server via a proxy server using php

* By Guy Boyd 2004*/



/* Fill out your proxy username and password

* and the address and port number of the proxy server */

$proxy_address="192.168.21.1";

$proxy_port="8080";



/* Enter the address of the remote server you wish to connect to. */

$path = "/newsticker.rdf";

$domain = "http://www.tagesschau.de";

/* We have all the ingredients, lets bake this cookie. */



$message = "GET $domain$path HTTP/1.1\r\n";

$message .= "Host: $domain\r\n";

$message .= "Connection: Close\r\n";

$message .= "\r\n";



/* Attempt to connect to the proxy server to retrieve the remote page */



if(!$socket = fsockopen($proxy_address, $proxy_port, $errno, $errstring, 20){

die("Could not connect to host $proxy_address : $errno : $errstring\n");

}



/* Write out the http commands to the socket. */

fwrite($socket, $message);



/* We then get the contents it returns, this includes the http headers

* as well as any <html> code. If need be you can strip the headers by

* removing everything before the first instance of "\r\n\r\n" */

$contents = "";

while (!feof($socket)){

$contents .= fgets($socket, 128);

}



/* Clean up */

fclose($socket);



/* Contents contains both the html headers and the html of the page.

* We can do whatever we want with it below here, we echo out as an example. */

echo $contents;



?>

Diese Scrpit gibt mir die Fehler Meldung aus Parse error: parse error, unexpected '{' in \RSS\proxy3.php on line 25

Danke für jede Hilfe

mfg

Markus Halm
 
Mal ein bisschen im Kaffeesatz suchen.. Ah jetzt..
Ist das Zeile 20:
PHP:
    if(!$socket = fsockopen($proxy_address, $proxy_port, $errno, $errstring, 20){
?

Falls ja, fehlt darin eine Klammer:
PHP:
    if(!$socket = fsockopen($proxy_address, $proxy_port, $errno, $errstring, 20)){
 
HI
erstmal Danke das war echt dumm das ich das übersehen hab so jetzt gehts erstmal weiter.
PRobier jetzt mla dsa übringen in den XML Praser

Jetzt noch ne zweite Frage die meisten seiten lassen sich jetzt öffnen aber nicht diese XML seiten.
Weiß jemand wie ich die geöffnet kriege?

Fehler Meldung

HTTP/1.0 400 Bad Request Date: Thu, 10 Feb 2005 11:55:14 GMT Server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-2 mod_ssl/2.8.22 OpenSSL/0.9.7d mod_perl/1.29 Content-Type: text/html; charset=iso-8859-1 Connection: Close
Bad Request

Your browser sent a request that this server could not understand.
Client sent malformed Host header


Danke

mfg
Markus Halm
 
Zuletzt bearbeitet:
Zurück