如何使用curl或API从http://developers.bringg.com/docs/users.


How to get data using curl or API from http://developers.bringg.com/docs/users

我只想要来自http://developers.bringg.com/docs/users在自定义字段Driver_info的wordpress自定义插件中使用curl。

 {
    extract($_POST);
    $url = 'http://parklee.loc/my-spaces-2/';
    $url = 'http://api.bringg.com/partner_api/users'; 
    $ch = curl_init(); 
    curl_setopt($ch,CURLOPT_URL, $url); 
    curl_setopt($ch,CURLOPT_POST,1); 
    curl_setopt($ch,CURLOPT_POSTFIELDS, "id=2"); 
    $result = curl_exec($ch); 
    echo "<pre>"; print_r($result); 
    curl_close($ch);
}

请告诉我这个代码出了什么问题。我得到错误404,未找到。我在里写了这行代码

{
    function order_my_custom( $post ){
        $shipping = get_post_meta( $post->ID, 'driver_info', true );
        wp_nonce_field( 'save_BFM_shipping', 'BFM_shipping_nonce' );
        woocommerce_wp_select( array( 'id' => 'driver_info', 'label' => __('Driver Info: ', 'woocommerce'), 'options' => array(
            'OPTION1' => __('c1', 'woocommerce'),
            'OPTION2' => __('c2', 'woocommerce')
            ) ) );
    }
}

而不是c1,c2我有一个名字。

阅读有关如何检索用户的文档时,需要将company_id作为参数发送

$data = [
    'company_id' => $id,
    // paginating data is good, even if it is optional
];
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded'r'n",
        'method'  => 'POST',
        'content' => http_build_query($data),
    ),
);
$context  = stream_context_create($options);
$response = json_decode(file_get_contents('http://api.bringg.com/partner_api/users', false, $context));

现在,您所需要的只是在响应变量中,您可以将其转储以查看其内容,并了解如何在

中循环