こんにちは私はこのデータを持っています。私はPHPを使用して変更したいものを変更したいのですが、その特定のデータにアクセスする方法がわかりません。また、私は変更したいデータにラベルを付けました。 IAM何をしては右である場合PHPデータの扱い
$wh = curl_init();
curl_setopt($wh, CURLOPT_URL, "https://core.voluum.com/campaigns/" . $id);
curl_setopt($wh, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($wh, CURLOPT_CUSTOMREQUEST, "GET");
$head = array();
$head[] = "Cwauth-Token: " . $tok;
curl_setopt($wh, CURLOPT_HTTPHEADER, $head);
$resulta = curl_exec($wh);
if (curl_errno($wh)) {
echo 'Error:' . curl_error($wh);
}
echo "Request:" . "<br>";
echo '<pre>' . print_r($resulta, true) . '</pre>';
$resulta->pathGroups->active='true';
は、私は本当に知らない:
{
"id" : "",
"name" : "",
"namePostfix" : "",
"updatedTime" : "2016-11-29T16:35:31.189Z",
"createdTime" : "2016-11-07T05:19:20.352Z",
"clientId" : "",
"url" : "",
"impressionUrl" : "",
"trafficSource" : {
"id" : "",
"name" : "",
"postbackUrl" : null,
"pixelRedirectUrl" : null,
"type" : "CUSTOM",
"predefinedType" : null
},
"country" : {
"code" : "NZ",
"name" : "New Zealand"
},
"costModel" : "CPA",
"clickRedirectType" : "DOUBLE_HTML",
"paths" : [ {
"weight" : 100,
"active" : true,
"landers" : [ {
"lander" : {
"id" : "",
"namePostfix" : "",
"name" : ""
},
"weight" : 100
} ],
"offers" : [ {
"offer" : {
"id" : "",
"name" : "",
"namePostfix" : ""
},
"weight" : 100
} ]
} ],
"pathsGroups" : [ {
"condition" : {
"country" : {
"predicate" : "MUST_BE",
"countryCodes" : [ "NZ" ]
},
"customVariableConditions" : [ {
"predicate" : "MUST_NOT_BE",
"index" : 0,
"texts" : [ "[zone]", "Unknown", "unknown" ],
"text" : "[zone]"
}, null, {
"predicate" : "MUST_NOT_BE",
"index" : 2,
"texts" : [ "Unknown", "[clickid]", "unknown" ],
"text" : "Unknown"
}, null, null, null, null, null, null, null ]
},
"paths" : [ {
"weight" : 100,
"active" : true,
"landers" : [ {
"lander" : {
"id" : "",
"namePostfix" : "",
"name" : ""
},
"weight" : 100
}, {
"lander" : {
"id" : "",
"namePostfix" : "",
"name" : ""
},
"weight" : 100
} ],
"offers" : [ {
"offer" : {
"id" : "",
"name" : "",
"namePostfix" : ""
},
"weight" : 100
} ]
} ],
"active" : false //change this to true
} ],
"cpa" : 1.2,
"revenueModel" : "RPA_AUTO",
"redirectTarget" : "INLINE",
"inlineFlow" : {
"name" : "",
"countries" : [ {
"code" : "",
"name" : ""
} ],
"conditionalPathsGroups" : [ {
"conditions" : {
"country" : {
"predicate" : "MUST_BE",
"countries" : [ {
"code" : "",
"name" : ""
} ]
},
"customVariable" : {
"values" : [ {
"predicate" : "",
"variableIndex" : 1,
"variableValues" :
}, {
"predicate" : "MUST_NOT_BE",
"variableIndex" : 3,
"variableValues" :
} ]
}
},
"paths" : [ {
"name" : "Path 1",
"active" : true,
"weight" : 100,
"landers" : [ {
"weight" : 100,
"lander" : {
"id" : "",
"name" : "",
"numberOfOffers" : 1,
"url" : ""
}
}, {
"weight" : 100,
"lander" : {
"id" : "",
"name" : "",
"numberOfOffers" : 1,
"url" : ""
}
} ],
"offers" : [ {
"weight" : 100,
"offer" : {
"id" : "",
"name" : "",
"url" : "",
"affiliateNetwork" : {
"id" : ""
}
}
} ],
"offerRedirectMode" : "DOUBLE_HTML",
"realtimeRoutingApiState" : "DISABLED"
} ]
} ],
"defaultPaths" : [ {
"name" : "Path 1",
"active" : true,
"weight" : 100,
"landers" : [ {
"weight" : 100,
"lander" : {
"id" : "",
"name" : "",
"numberOfOffers" : 1,
"url" : ""
}
} ],
"offers" : [ {
"weight" : 100,
"offer" : {
"id" : "",
"name" : "",
"url" : "",
"affiliateNetwork" : {
"id" : ""
}
}
} ],
"offerRedirectMode" : "DOUBLE_HTML",
"realtimeRoutingApiState" : "DISABLED"
} ],
"defaultOfferRedirectMode" : "DOUBLE_HTML"
}
}
は、ここに私のコードです。はい私はこのコードで値を変更している
$wh = curl_init();
curl_setopt($wh, CURLOPT_URL, "https://core.voluum.com/campaigns/" . $id);
curl_setopt($wh, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($wh, CURLOPT_CUSTOMREQUEST, "GET");
$head = array();
$head[] = "Cwauth-Token: " . $tok;
curl_setopt($wh, CURLOPT_HTTPHEADER, $head);
$resulta = curl_exec($wh);
if (curl_errno($wh)) {
echo 'Error:' . curl_error($wh);
}
echo "Request:" . "<br>";
$campinfo = json_decode($resulta, true);
echo '<pre>' . print_r($campinfo, TRUE) . '</pre>';
foreach($campinfo['pathsGroups'] as $datacamp){
echo $datacamp['active']=1;
が、私の問題は、私は背の$ resulta変数に値を置く方法です:誰かが がここでjson_decode を使用すると、私はjson_decodeを使用する私のコードで試してみました私を助けてください私はサーバーに提出する前に、すべてのデータをワンピースで取得する必要があります。
あなたは( 'json_decodeを試してみました) '? – Raptor
あなたにはどんなエラーがありますか?また、 'true'の前後で引用符を削除してください。 – KDOT
それは何のエラーも与えず、私のポストを更新し、私が使用する部分を追加します。json_decodeは私に秒を与えます –