Services_Pingback
[ class tree: Services_Pingback ] [ index: Services_Pingback ] [ all elements ]

Source for file send.php

Documentation is available at send.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker */
  3.  
  4. /**
  5.  * Services_Pingback send example.
  6.  */
  7.  
  8. if (isset($_REQUEST['source'])) {
  9.     highlight_file(__FILE__);
  10.     die;
  11. }
  12.  
  13.  
  14. // Load Services_Pingback
  15. require_once 'Services/Pingback.php';
  16.  
  17. // Setting up URIs
  18. $selfURI 'http://' .$_SERVER['HTTP_HOST'$_SERVER['PHP_SELF'];
  19. $sourceURI 'http://' .$_SERVER['HTTP_HOST'dirname($_SERVER['PHP_SELF']'/source.php';
  20. $targetURI 'http://' .$_SERVER['HTTP_HOST'dirname($_SERVER['PHP_SELF']'/target.php';
  21.  
  22. // let's assume that we don't know this pingback URI, to test
  23. // Services_Pingback::autoDiscover() method.
  24. $pingbackURI 'http://' .$_SERVER['HTTP_HOST'dirname($_SERVER['PHP_SELF']'/receive.php';
  25.  
  26. $options = array(
  27.     'debug' => true
  28. );
  29.  
  30. $data = array(
  31.     'sourceURI' => $sourceURI,
  32.     'targetURI' => $targetURI
  33. );
  34.  
  35. $pingback = new Services_Pingback($data$options);
  36.  
  37. print '<h2>Services_Pingback Example</h2>' "\n" .
  38.       'Sources: ' .
  39.       '<a href="' $selfURI '?source" target="_blank">send.php</a> | ' .
  40.       '<a href="' $pingbackURI '?source" target="_blank">receive.php</a> | ' .
  41.       '<a href="' $sourceURI '?source" target="_blank">source.php</a> | ' .
  42.       '<a href="' $targetURI '?source" target="_blank">target.php</a>' .
  43.       '<hr />' "\n" .
  44.       '<strong>source URI</strong>: <a href="' $sourceURI '" target="_blank">' $sourceURI "</a><br />\n" .
  45.       '<strong>target URI</strong>: <a href="' $targetURI '" target="_blank">' $targetURI "</a><br />\n";
  46.  
  47. print '<strong>------------------------- Sending Pingback --------------------------</strong>' "<br />\n";
  48. $res $pingback->send();
  49.  
  50. print '<strong>------------------------- Received Response -------------------------</strong>' "<br />\n";
  51. if (PEAR::isError($res)) {
  52.     $response $res->getMessage();
  53. else {
  54.     $response $res;
  55. }
  56. print '<strong>Response</strong>: ' $response;
  57.  
  58. /*
  59.  * Local variables:
  60.  * mode: php
  61.  * tab-width: 4
  62.  * c-basic-offset: 4
  63.  * c-hanging-comment-ender-p: nil
  64.  * End:
  65.  */
  66. ?>

Documentation generated on Mon, 11 Mar 2019 14:49:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.