dongqing483174 2016-03-23 20:01
浏览 62

使用PHP发送数组

I have a PHP array called $json that I decoded from my .txt file. It has information laid out like this:

enter image description here

I'm trying to send the [email] and [fullname] to my database using PHP. I'm confused how to actually add the $json array to my code. I've been successful in adding the sample data but when replacing the add(array(my code breaks. Can anyone give me a tip on how to pursue further?

$url = 'http://www.mywebsite.com/form/test.txt';
$content = file_get_contents($url);
$json = json_decode($content,true);
str_replace(array('[', ']'), '', htmlspecialchars(json_decode($json), ENT_NOQUOTES));
$auth = array(
'api_key' => 'xxxxxxxxxxxxx');
$wrap = new CS_REST_Subscribers('xxxxxxxxx', $auth);
$result = $wrap->add(array(
'EmailAddress' => "thisisatest@gmail.com",
'Name' => "john",
'CustomFields' => array(
    array(
        'Key' => 'Field 1 Key',
        'Value' => 'Field Value'
    ),
    array(
        'Key' => 'Field 2 Key',
        'Value' => 'Field Value'
    ),
    array(
        'Key' => 'Multi Option Field 1',
        'Value' => 'Option 1'
    ),
    array(
        'Key' => 'Multi Option Field 1',
        'Value' => 'Option 2'
    )
),
'Resubscribe' => true
));
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 delta降尺度方法,未来数据怎么降尺度
    • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
    • ¥15 再不同版本的系统上,TCP传输速度不一致
    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程