indieweb / mention-client-php

Client library for sending webmention and pingback notifications
https://indieweb.org/webmention
97 stars 19 forks source link

requires xmlrpc module #22

Closed kylewm closed 8 years ago

kylewm commented 8 years ago

The call to xmlrpc_decode failed on vanilla Ubuntu because I did not have the php5-xmlrpc module installed (Debian-derived distros at least seem to break less common stdlib functions into separate modules)

I think it would be worthwhile to make this a soft requirement (check for existence of the function before calling it) or remove it altogether and verify the response manually, since pingback is kind of secondary and we're not doing much with the response anyway.

kylewm commented 8 years ago

Actually could we just return true if the response code is 200, 201, 202, just like webmentions?

aaronpk commented 8 years ago

hm, not sure how I ended up adding xmlrpc_decode in there, since the whole reason I wrote my own encode method was to avoid relying on that function existing.

I don't actually see anything in the Pingback spec about HTTP codes. Does this mean that current Pingback implementations might return HTTP 200 even if there is an error?

I would be okay with regexing the XML response to check for an error though. (I know I know, but come on, it's better than XMLRPC)

voxpelli commented 8 years ago
return $response['body'] && strpos($response['body'], '<fault>') === false && strpos($response['body'], '<string>') !== false;

As long as people haven't added lots of whitespace and attributes to an XML-RPC response then I think that would do the trick after having read the wikipedia page for XML-RPC quickly.

aaronpk commented 8 years ago

Could also remove newlines and whitespace before testing just to be safe? Otherwise this looks fine.