3
我想使用wp_remote_post從一臺服務器發送信息到我的其他網站。WordPress的wp_remote_post
所以基本上,我已經加入這一行我的代碼 -
$sidebarHTTP = site_url(); // Retrieves HTTP Url of sidebar
$sidebarActivation = $sidebar.' , '.$sidebarHTTP; // Activate Sidebar
$args = array(
'method' => 'post',
'body' => array('sidebar' => $sidebar, 'sidebarHTTP' => $sidebarHTTP),
'user-agent' => 'My site'
);
wp_remote_post('http://mysite.com', $args); // Loads all default data
因此,基本上,它不發送任何東西。是的,我輸入了正確的域名。也許它確實發送了一些東西,但我不知道如何從該網站獲取$ args ['body']。此外,我嘗試添加$ response = wp_remote_post ....然後發送郵件$ response ['body'],但它只是將主頁的源代碼發送到電子郵件。
希望能有所幫助。
1,做u看到這個頁面:http://codex.wordpress.org/Function_API/wp_remote_post;第二,檢查捲曲是否打開? – Sergey