douren4075 2018-10-06 07:35
浏览 42

wordpress wp_remote_post从另一个wordpress网站获取响应

Everyone, I am New for Wordpress Development I develop one plugin there is two Wordpress site. site 1 sends the request to site 2. And site 2 will send some response for site 1 requests

site 1 index.php look like

$url = 'http://localhost/wordpress1/';
    $get_post_id = $commentdata['comment_details']['comment_post_ID'];
    $response = wp_remote_post( $url, array(
    'method' => 'POST',
    'timeout' => 45,
    'redirection' => 5,
    'httpversion' => '1.0',
    'blocking' => true,
    'headers' => array(),
    'body' => array('comment_details'=>$commentdata,'post_details'=>$post_details),
    'cookies' => array()
    ));
$response_data =  $response['body'];

site 2: index.php file looks like

$data = //some array data i will return
$sample =  serialize($data);

output: Its works good

my Requirement:

we have written the code both sites but t want to manage all those things in site 1 plugin code how to connect both code single plugin page(request and response handle in the single plugin)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?