Update of /cvsroot/curl/curl-www/libcurl/php/examples
In directory labb:/tmp/cvs-serv21370/examples
Added Files:
Makefile mkindex.pl
Log Message:
Generate static HTML versions of the examples. Less server load, makes them
get mirrored properly.
--- NEW FILE: mkindex.pl ---
#!/usr/local/bin/perl
require "/home/dast/perl/date.pm";
require "../../../curl.pm";
require "CGI.pm";
sub listexamples {
print <<MOO
<p>
We try to collect examples on how to program the CURL interface from PHP
here. If you have any source snippests you want to share with the rest of the
world, please let <a href="mailto:[email protected]">us</a> know!
MOO
;
my $some_dir=".";
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
my @ex = grep { /\.php$/ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
print "<p><table border=\"0\" cellpadding=\"1\" cellspacing=\"0\"><tr class=\"tabletop\">",
"<th>Example</th>",
"<th>Description</th>",
"</tr>\n";
my $c;
for(sort @ex) {
$filename = $_;
my $class= ($c++&1)?"odd":"even";
print "<tr class=\"$class\" valign=\"top\"><td>";
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
my $exfile = $filename;
$exfile =~ s/\.php$/.html/;
print "<a href=\"./$exfile\">$filename</a></td><td>\n";
if( -r "$filename.html") {
&catfile("$filename.html");
}
else {
print " ";
}
print "</td></tr>\n";
}
print "</table>\n";
}
&catfile("../examples.html");
# get example file name from argv
$ex = $ARGV[0];
if($ex) {
if($ex =~ /\.\./) {
$ex = "invalid";
}
else {
$ex =~ s/.*\/(.*)/$1/;
}
where("libcurl", "/libcurl/",
"PHP", "/libcurl/php/",
"Examples", "/libcurl/php/examples/",
$ex);
&title("The $ex Example");
if( -r "$ex.html") {
precatfile("$ex.html");
}
precatfile($ex);
}
else {
where("libcurl", "/libcurl/",
"PHP", "/libcurl/php/",
"Examples");
&title("PHP/CURL Examples Collection");
listexamples();
}
&catfile("../../../foot.html");
--- NEW FILE: Makefile ---
ROOT = ../../..
TXT2PLAIN= $(ROOT)/docs/txt2plain.pl
MAINPARTS= $(ROOT)/_doctype.html ../_menu.html $(ROOT)/setup.t \
$(ROOT)/where.t $(ROOT)/mirrorlinks.t $(ROOT)/ad.t $(ROOT)/sflogo.t
NOW=$(shell gnudate +'-D__TODAY__=%B %d, %Y')
ACTION=@echo preprocessing $@; rm -f $@; cpp -I.. -I$(ROOT) -P -WWW -Uunix -H -C -V -LL "$(NOW)" $< $@; chmod a-w+r $@
PHPSRC = $(shell echo *.php)
PHPHTML = $(patsubst %.php,%.html,$(PHPSRC))
all: index.html $(PHPHTML)
index.html: ./mkindex.pl $(MAINPARTS)
./mkindex.pl > $@
%.html: %.php ./mkindex.pl
echo $@ $<
./mkindex.pl $< > $@
php:
(for i in $(PHPSRC); do \
echo $$i; \
done)
html:
echo $(PHPHTML)
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.