├── LICENSE.txt ├── README.md ├── composer.json └── webmention.php /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by Sandeep Shetty 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # phpish/webmention 2 | 3 | Simple Webmention (http://webmention.org/) client in PHP. 4 | 5 | 6 | ## Namespace 7 | 8 | `phpish\webmention` 9 | 10 | 11 | ## Functions 12 | 13 | string __discover__( string _$target_url_ ) 14 | 15 | array __send__( string _$source_url_ , string _$target_url_ ) -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phpish/webmention", 3 | "type": "library", 4 | "description": "Simple Webmention (http://webmention.org/) client in PHP", 5 | "keywords": ["webmention", "pingback"], 6 | "homepage": "https://github.com/phpish/webmention", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Sandeep Shetty", 11 | "email": "sandeep.shetty@gmail.com", 12 | "homepage": "http://sandeep.shetty.in" 13 | } 14 | ], 15 | "require": { 16 | "php": ">=5.3.0", 17 | "phpish/http": "v1.0.0", 18 | "phpish/link_header": "v1.0.0" 19 | }, 20 | "autoload": { 21 | "files": ["webmention.php"] 22 | } 23 | } -------------------------------------------------------------------------------- /webmention.php: -------------------------------------------------------------------------------- 1 | #i', $response_body, $matches) or preg_match('##i', $response_body, $matches)) 21 | { 22 | return $matches[1]; 23 | } 24 | } 25 | 26 | 27 | function send($source_url, $target_url) 28 | { 29 | if ($target_webmention_endpoint = discover($target_url)) 30 | { 31 | $response_body = http\request("POST $target_webmention_endpoint", array(), array('source'=>$source_url, 'target'=>$target_url), $response_headers); 32 | return array('headers'=>$response_headers, 'body'=>$response_body); 33 | } 34 | } 35 | 36 | ?> --------------------------------------------------------------------------------