- Writers needed:
Los Angeles
Spain
Netherlands
Berlin
Belgium - FRIGHTFEST 2010: Review of RED WHITE & BLUE
- FRIGHTFEST 2010: Review of MONSTERS
- FRIGHTFEST 2010: Review of THE DEAD
- FRIGHTFEST 2010: Review of THE LOVED ONES
- FRIGHTFEST 2010: Review of THE PACK (LA MEUTE)
- FRIGHTFEST 2010: Review of RED HILL
- FRIGHTFEST 2010: Review of British hallway horror F
- FRIGHTFEST 2010: Review of PRIMAL
- Early review of NBC's upcoming THE EVENT
- More cocks than a hen house! It's our EXPENDABLES review!
- OVERLOOKED AT CANNES 2010: Review of LITTLE BABY JESUS OF FLANDR
- Re: Genre Film Fest Schedule?
- Seems like an event we all should be interested in.
- Re: Paranormal Activity 2
- Re: Post-Apocalyptic Radio Dramas
- Re: Post-Apocalyptic Radio Dramas
- Re: Post-Apocalyptic Radio Dramas
- Review of Y: The Last Man
- end of the world - pixel style
- Microreview: Dies the Fire
- Re: Hello is anybody there?
- Second trailer for wannabe anaimated zombie apocalypse YEAR ZERO
- Official trailer for AMC's THE WALKING DEAD. Pilot airing October 31st!
- New stills for zombie PA comic adaptation THE WALKING DEAD. Airing October 8th?
- TIFF 2010: Brad Anderson’s VANISHING ON 7TH STREET gets a trailer
- New artwork and status update on TIMELESS!
- Retro Slave: post apocalyptic double header disc a real score for cult junkies
- Review of Soderbergh's CONTAGION script
- Stunning comic art for Joseph Kosinski's PA scifi flick OBLIVION
- First gorgeous still from German PA flick THE END OF NIGHT (DAS ENDE DER NACHT) - Roland Emmerich producing!
- Play the name game, what PA films does THE COLLAPSED sound like?
- Watch Jeunet and Marc Caro's awesome BUNKER OF THE LAST GUNSHOTS
- Official trailer for prosody experiment ANAPHYLAXIS
- Multiple Personality Disorder report
- Second trailer for wannabe anaimated zombie apocalypse YEAR ZERO
- Watch Nikola Tesla's robot gear up in the preview for Atomic Robo: Last Stop
- FRIGHTFEST 2010: Review of PRIMAL
- Neil Marshall ventures UNDERGROUND into the world of extreme cuisine
- FANTASTIC FEST 2010: Second wave of titles announced
- Family drama & horror meet in Dyer Evans' THE DAMNED
- Noomi Rapace sheds Dragon Tattoo for more family drama in the BEYOND (SVINALÄNGORNA) trailer
- Mexican alien invasion thriller SERES: GENESIS finds North American distro
- Support a PANDORUM trilogy by joining this Facebook page today!
- TIFF 2010: Adam Wingard’s A HORRIBLE WAY TO DIE has a trailer!
- FRIGHTFEST 2010: Trailer for Johannes Roberts school hall horror F
- [REC] GENESIS and APOCALYPSE on the horizon
- TIFF 2010: First clips from Bogdan George Apetri's Romanian drama OUTBOUND (PERIFERIC)
- First look at Bean, Slater, Monaghan and Rhames in SOLDIERS OF FORTUNE
- Teens, peer pressure & the ensuing drama. Trailer for Kaspar Munk’s HOLD ME TIGHT (HOLD OM MIG)
- Heads explode, literally, in PRESENCE
- Dude + fungus = POLYPORE
- SANDRIMA RISING is a fan film set in the Star Wars galaxy
News
Reviews
Forums
Post apocalyptic list
Misc

Join QE!
Latest Reviews
Latest Forum Posts
PA News
Older News

Posted on Monday, October 30th, 2006 23:56:43 GMT by: quietearth
Posted under: blog php pingback
Here's a tutorial (howto) on coding your own pingback mechanism for your blog using version 2.0 of the phpxmlrpc library available from sourceforge.
1. Receiving pingbacks
The pingback specs are available here:
http://www.hixie.ch/specs/pingback/pingback
When a client sends a pingback, it requests the page of the article being pinged and looks for either the X-Pingback header or a link the html header section of the page. This tells the client sending the pingback the url to actually send the pingback too. So first off we need to add these in to every page which serves articles.
This is part of the http header, so you need this before any html is served out:
header("X-Pingback: http://www.yoursite.com/pingback.php");This is for the html header section:
<link rel="pingback" href="http://www.yoursite.com/pingback.php" />The rest is simply making the pingback server itself. Here's the skeleton for pingback.php:
<?
header("Content-Type: application/xml");
require_once('/path/to/xmlrpc/lib/xmlrpc.inc');
require_once('/path/to/xmlrpc/lib/xmlrpcs.inc');
function pbprocess($m) {
global $xmlrpcerruser;
$x1 = $m->getParam(0);
$x2 = $m->getParam(1);
$source = $x1->scalarval(); # their article
$dest = $x2->scalarval(); # your article
# INSERT CODE
# here we can check for valid urls in source and dest, security
# lookup the dest article in our database etc..
if (..) { # source uri does not exist
return new xmlrpcresp(0, 16, "Source uri does not exist");
}
if (..) { # source uri does not have a link to target uri
return new xmlrpcresp(0, 17, "Source uri does have link to target uri");
}
if (..) { # target uri does not exist
return new xmlrpcresp(0, 32, "Target uri does not exist");
}
if (..) { # target uri cannot be used as target
return new xmlrpcresp(0, 33, "Target uri cannot be used as target");
}
if (..) { # Pingback already registered
return new xmlrpcresp(0, 48, "Target uri cannot be used as target");
}
if (..) { # Access denied
return new xmlrpcresp(0, 49, "Access denied");
}
if (..) { # Could not communicate with upstream server or got error
return new xmlrpcresp(0, 50, "Problem with upstream server");
}
if (..) { # Generic fault code if not applicable to above
return new xmlrpcresp(0, 50, "Unkown error");
}
return new xmlrpcresp(new xmlrpcval("Pingback registered. May the force
be with you.", "string"));
}
$a = array( "pingback.ping" => array( "function" => "pbprocess" ));
$s = new xmlrpc_server($a, false);
#$s->setdebug(3);
$s->service();
?>The xmlrpc_server class from the xmlrpcphp module processes the post and uses pbprocess as a callback to return the data. From the pbprocess function we need to return a valid xmlrpcresp, and this gets passed off to the client. This is pretty straightforward. On a side note, I use the Access denied (error 49) as a generic error response in case none of the others fit.
2. Sending pingbacks
For sending pingbacks, we need to pass the entire text of a post put on the blog to a parsing routine. This routine send_pingback which is below, looks for all the html links and runs through each one of these pages looking for the X-Pingback header. (At this time I haven't implemented the html link reference.) If it finds this header, it will submit a pingback to the specified url.
<?
require_once('/path/to/xmlrpc/lib/xmlrpc.inc');
function do_send_pingback($myarticle, $url, $pdebug = 0) {
$parts = parse_url($url);
if (!isset($parts['scheme'])) {
print "do_send_pingback: failed to get url scheme [".$url."]<br />\n";
return(1);
}
if ($parts['scheme'] != 'http') {
print "do_send_pingback: url scheme is not http [".$url."]<br />\n";
return(1);
}
if (!isset($parts['host'])) {
print "do_send_pingback: could not get host [".$url."]<br />\n";
return(1);
}
$host = $parts['host'];
$port = 80;
if (isset($parts['port'])) $port = $parts['port'];
$path = "/";
if (isset($parts['path'])) $path = $parts['path'];
if (isset($parts['query'])) $path .="?".$parts['query'];
if (isset($parts['fragment'])) $path .="#".$parts['fragment'];
$fp = fsockopen($host, $port);
fwrite($fp, "GET $path HTTP/1.0\r\nHost: $host\r\n\r\n");
$response = "";
while (is_resource($fp) && $fp && (!feof($fp))) {
$response .= fread($fp, 1024);
}
fclose($fp);
$lines = explode("\r\n", $response);
foreach ($lines as $line) {
if (ereg("X-Pingback: ", $line)) {
list($pburl) = sscanf($line, "X-Pingback: %s");
#print "pingback url is $pburl<br />\n";
}
}
if (empty($pburl)) {
print "Could not get pingback url from [$url].<br />\n";
return(1);
}
if (!isset($parts['scheme'])) {
print "do_send_pingback: failed to get pingback url scheme [".$pburl."]<br />\n";
return(1);
}
if ($parts['scheme'] != 'http') {
print "do_send_pingback: pingback url scheme is not http[".$pburl."]<br />\n";
return(1);
}
if (!isset($parts['host'])) {
print "do_send_pingback: could not get pingback host [".$pburl."]<br />\n";
return(1);
}
$host = $parts['host'];
$port = 80;
if (isset($parts['port'])) $port = $parts['port'];
$path = "/";
if (isset($parts['path'])) $path = $parts['path'];
if (isset($parts['query'])) $path .="?".$parts['query'];
if (isset($parts['fragment'])) $path .="#".$parts['fragment'];
$m = new xmlrpcmsg("pingback.ping", array(new xmlrpcval($myarticle, "string"), new xmlrpcval($url, "string")));
$c = new xmlrpc_client($path, $host, $port);
$c->setRequestCompression(null);
$c->setAcceptedCompression(null);
if ($pdebug) $c->setDebug(2);
$r = $c->send($m);
if (!$r->faultCode()) {
print "Pingback to $url succeeded.<br >\n";
} else {
$err = "code ".$r->faultCode()." message ".$r->faultString();
print "Pingback to $url failed with error $err.<br >\n";
}
}
# call send_pingback() from your blog after adding a new post,
# $text will be the full text of your post
# $myurl will be the full url of your posting
function send_pingback($text, $myurl) {
$m = array();
preg_match_all ("/<a[^>]*href=[\"']([^\"']*)[\"'][^>]*>(.*?)<\/a>/i", $text, $m);
$c = count($m[0]);
for ($i = 0; $i < $c; $i++) {
$ret = valid_url($m[1][$i]);
if ($ret) do_send_pingback($myurl, $m[1][$i]);
}
}
?>I have put up a page to allow you to test sending and receiving pingbacks from your blog:
http://www.quietearth.us/webtools
RSS Feed for commentsComments
Posted by: obokaman | January 15, 2007 08:57:07 am | permalink
Posted by: ikari | February 20, 2007 02:46:07 pm | permalink
Posted by: quietearth | February 20, 2007 03:00:27 pm | permalink
Posted by: Mindloop Webdesign | July 4, 2007 06:55:21 am | permalink
Posted by: Mike | August 6, 2007 10:54:37 pm | permalink
Posted by: Mike | August 6, 2007 11:43:06 pm | permalink
Posted by: Kestas | August 20, 2007 05:46:10 am | permalink
Posted by: Kestas | August 20, 2007 07:23:37 am | permalink
Posted by: quietearth | August 20, 2007 03:54:17 pm | permalink
Posted by: Kestas | August 21, 2007 03:24:32 am | permalink
Posted by: Tyler | October 16, 2007 08:56:19 am | permalink
Posted by: snydez | December 5, 2007 12:05:59 am | permalink
Posted by: scott klarr | December 10, 2007 02:49:09 am | permalink
Posted by: vivevtvivas | January 3, 2008 11:21:18 am | permalink
Posted by: Lazar | February 8, 2008 05:14:17 pm | permalink
Posted by: rio | February 18, 2008 07:54:34 am | permalink
Posted by: LukasS | March 1, 2008 11:28:23 am | permalink
Posted by: Trezub | April 25, 2008 04:45:04 am | permalink
Posted by: akifemre | May 25, 2008 03:10:35 am | permalink
Posted by: Allan Wirth | June 24, 2008 11:12:19 pm | permalink
Posted by: Origin | October 3, 2008 05:12:40 am | permalink
Posted by: Ramon Fincken | January 31, 2009 12:18:39 pm | permalink
Posted by: Ramon Fincken | January 31, 2009 01:48:57 pm | permalink
Posted by: angelxmoreno | July 2, 2010 10:43:45 am | permalink
Post a comment
Related articles
rss | subscribe via email | the team | contact us | mobile
© 2006-2009 Don Neumann (except where applicable)
We are looking for free hosting with a cut of sales, you'll get a link right here.
If you want news of your film posted, use our contact page and we'll check it out
Permission is granted to use material from this site if you provide a reference to us via a link and DO NOT HOTLINK.
GenreBanners.com Banner Exchange