Supportnet / Forum / Skripte(PHP,ASP,Perl...)
Webseite mit PHP auslesen...
Frage
Hallo, vielleicht kann mir jemand helfen. Ich möchte eine bestimmte Webseite mit einem PHP-Script auslesen und dadurch die URL zu einem Bild auf dieser Webseite erhalten. Geht das?
Gruß
HYCO
Antwort 1 von svensen
Du mußt die Website als String einlesen und dann mit split() teilen oder mit Hilfe von regulären Ausdrücken die URL isolieren.
Ist aber sicher etwas kompliziert ..
Good Luck!
Ist aber sicher etwas kompliziert ..
Good Luck!
Antwort 2 von Hyco
Danke für die Antwort. Aber mit welchem Befehl kann ich denn die Website als String einlesen??
Antwort 3 von MixMax
du könntest fopen verwenden, es gibt sicher mehrere wege.
Antwort 4 von Hyco
Hat vielleicht jemand einen Code-Snipsel für so etwas??
Antwort 5 von robbie17
am einfachsten geht das wohl mit Snoopy
wenn du mit der englischen anleitung zurechtkommst ist es ein kinderspiel
außerdem hat diese erweiterung noch einige zusätzliche (geile!) features
wenn du mit der englischen anleitung zurechtkommst ist es ein kinderspiel
außerdem hat diese erweiterung noch einige zusätzliche (geile!) features
Antwort 6 von helferlein
ja, JEMAND hat da was
LESEN BILDET
Zitat:
fread
(PHP 3, PHP 4 )
fread -- Binary-safe file read
Description
string fread ( resource handle, int length)
fread() reads up to length bytes from the file pointer referenced by handle. Reading stops when length bytes have been read, EOF (end of file) is reached, or (for network streams) when a packet becomes available, whichever comes first.
<?php
// get contents of a file into a string
$filename = "/usr/local/something.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>
Warning
On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen() mode parameter.
<?php
$filename = "c:\\files\\somepic.gif";
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>
Warning
When reading from network streams or pipes, such as those returned when reading remote files or from popen() and proc_open(), reading will stop after a packet is available. This means that you should collect the data together in chunks as shown in the example below.
<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = "";
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
} while (true);
fclose($handle);
?>
Note: The example above has better performance than the traditional approach using while(!feof()), as we are saving the overhead of a function call per iteration.
Note: If you just want to get the contents of a file into a string, use file_get_contents() as it has much better performance than the code above.
See also fwrite(), fopen(), fsockopen(), popen(), fgets(), fgetss(), fscanf(), file(), and fpassthru().
fread
(PHP 3, PHP 4 )
fread -- Binary-safe file read
Description
string fread ( resource handle, int length)
fread() reads up to length bytes from the file pointer referenced by handle. Reading stops when length bytes have been read, EOF (end of file) is reached, or (for network streams) when a packet becomes available, whichever comes first.
<?php
// get contents of a file into a string
$filename = "/usr/local/something.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>
Warning
On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen() mode parameter.
<?php
$filename = "c:\\files\\somepic.gif";
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>
Warning
When reading from network streams or pipes, such as those returned when reading remote files or from popen() and proc_open(), reading will stop after a packet is available. This means that you should collect the data together in chunks as shown in the example below.
<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = "";
do {
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
}
$contents .= $data;
} while (true);
fclose($handle);
?>
Note: The example above has better performance than the traditional approach using while(!feof()), as we are saving the overhead of a function call per iteration.
Note: If you just want to get the contents of a file into a string, use file_get_contents() as it has much better performance than the code above.
See also fwrite(), fopen(), fsockopen(), popen(), fgets(), fgetss(), fscanf(), file(), and fpassthru().
LESEN BILDET
Antwort 7 von Hyco
Vielen Dank für Eure Hilfe, ich werde es gleich ausprobieren!