admin管理员组文章数量:1130349
If I call
curl -I
In terminal I get the correct response
Link: </>; rel="/"
If I call
$response = wp_remote_head( '' );
The I print_r the response. The Link: I get is
Link: ; rel="/"
Link: ; rel=shortlink
There seems to be the href stripped out of the data, but the semi-colon has been left. This is the reccomemded way from wordpress to assert if REST api is active and if pretty permalinks are selected.
What is the correct way to get the href link from the from a page header?
If I call
curl -I https://example
In terminal I get the correct response
Link: <https://example/wp-json/>; rel="https://api.w/"
If I call
$response = wp_remote_head( 'https://example' );
The I print_r the response. The Link: I get is
Link: ; rel="https://api.w/"
Link: ; rel=shortlink
There seems to be the href stripped out of the data, but the semi-colon has been left. This is the reccomemded way from wordpress to assert if REST api is active and if pretty permalinks are selected.
What is the correct way to get the href link from the from a page header?
Share Improve this question asked Dec 5, 2018 at 6:47 digitalcreative.techdigitalcreative.tech 215 bronze badges1 Answer
Reset to default 0Turns out it was there all along, but being rendered into an html tag during the output. I ended up using;
echo htmlspecialchars($response);
To get this to be displayed correctly on the page. Although I want to be checking against it in php, which I haven't go to figuring out yet, it is nice to have found it working correctly. It was displayed in the html in the element inspector which I hadn't thought to check ....whooops.
If I call
curl -I
In terminal I get the correct response
Link: </>; rel="/"
If I call
$response = wp_remote_head( '' );
The I print_r the response. The Link: I get is
Link: ; rel="/"
Link: ; rel=shortlink
There seems to be the href stripped out of the data, but the semi-colon has been left. This is the reccomemded way from wordpress to assert if REST api is active and if pretty permalinks are selected.
What is the correct way to get the href link from the from a page header?
If I call
curl -I https://example
In terminal I get the correct response
Link: <https://example/wp-json/>; rel="https://api.w/"
If I call
$response = wp_remote_head( 'https://example' );
The I print_r the response. The Link: I get is
Link: ; rel="https://api.w/"
Link: ; rel=shortlink
There seems to be the href stripped out of the data, but the semi-colon has been left. This is the reccomemded way from wordpress to assert if REST api is active and if pretty permalinks are selected.
What is the correct way to get the href link from the from a page header?
Share Improve this question asked Dec 5, 2018 at 6:47 digitalcreative.techdigitalcreative.tech 215 bronze badges1 Answer
Reset to default 0Turns out it was there all along, but being rendered into an html tag during the output. I ended up using;
echo htmlspecialchars($response);
To get this to be displayed correctly on the page. Although I want to be checking against it in php, which I haven't go to figuring out yet, it is nice to have found it working correctly. It was displayed in the html in the element inspector which I hadn't thought to check ....whooops.
本文标签: REST api header link href
版权声明:本文标题:REST api header link href 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749122725a2319271.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论