开发者

Error connecting through proxy in wordpress plugin via fsockopen

I'm using the stats plugin for wordpress which uses a core wordpress class IXR_Client in class-IXR. Although according to documentation it uses the proxy config found in wp-config.php I see no way it can as it uses the same address for host as it does in fsockopen (looking at fsockopen it should be the proxy address)

I've modified the fsockopen to point to my proxy and it does receive a response now from the proxy although 'TCP_DENIED/400 4139 POST error:invalid-request - NONE/- text/html' comes up in the proxy logs and the proxy returns an error. I have a feeling I'm not wrapping the request right for the proxy.

The request: (some things changed)

POST /xmlrpc.php HTTP/1.0 Host: wordpress.com Content-Type: 
text/xml User-Agent: The Incutio XML-RPC PHP Library Content-Length: 1770 <?xml 
version="1.0"?> <methodCall> <methodName>wpStats.check_key</methodName> <params> 
<param><value><string>123456789012</string></value></param> <param><value><struct> 
<member><name>host</name><value><string>thedomainoftheblog.com</string></value></member> 
<member><name>path</name><value><string>/</string></value></member> 
<member><name>admin_bar</name><value><string>1</string></value></member> 
<member><name>wp_me</name><value><string>1</string></value></member> 
<member><name>reg_users</name><value><stri开发者_StackOverflowng></string></value></member> 
<member><name>footer</name><value><string>1</string></value></member> 
<member><name>version</name><value><string>7</string></value></member> 
<member><name>error</name><value><string></string></value></member> 
<member><name>blogname</name><value><string>THE | BLOG NAMEFUL</string></value></member> 
<member><name>blogdescription</name><value><string>blogs name norma 
l</string></value></member><member><name>siteurl</name>
<value><string>http://thedomainoftheblog.com</string></value></member> 
<member><name>gmt_offset</name><value><string>0</string></value></member> 
<member><name>timezone_string</name><value><string></string></value></member> 
<member><name>stats_version</name><value><string>7</string></value></member> 
<member><name>stats_api</name><value><string>jetpack</string></value></member> 
<member><name>page_on_front</name><value><string>0</string></value></member>
<member><name>permalink_structure</name><value>
<string>/%year%/%monthnum%/%day%/%postname%/</string></value></member> 
<member><name>category_base</name><value><string></string></value></member> 
<member><name>tag_base</name><value><string></string></value></member> </struct></value></param> </params></methodCall>

If you need more information let me know.

Cheers


The trick seems to be to add http://your.domain.name/ on the POST request (i.e. not only POST/name-of-file, as class-IXR.php has by default), at least according to the following link: http://thedeadone.net/how-to/livejournal-and-wordpress/

I've tried it out and it certainly works.


There are a few proxy-related constants in WP, as well as a whole bunch of other constants used in wp-includes/class-http.php. Have you tried to set any or all of them? e.g.:

WP_PROXY_HOST
WP_PROXY_PORT
WP_PROXY_USERNAME
WP_PROXY_PASSWORD
WP_PROXY_BYPASS_HOSTS
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜