Google ads api for keywordideas in CURL PHP
I try to make a keyword searches system for our employ and i have google ads developer token But I cannot able to find any CURL or PHP CURL setup guide.
Two reference links Ad API Examples
Method: customers.generateKeywordIdeas
An example from Google's documentation:
curl -f --request POST "https://googleads.googleapis.com/v${API_VERSION}/customers/${CUSTOMER_ID}/campaignBudgets:mutate" \ --header "Content-Type: application/json" \ --header "developer-token: ${DEVELOPER_TOKEN}" \ --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \ --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \ --data "{ 'operations': [ { 'create': { 'name': 'My Campaign Budget #${RANDOM}', 'amountMicros': 500000, } }, { 'create': { 'name': 'My Campaign Budget #${RANDOM}', 'amountMicros': 500000, } } ] }"
I try this code but got Error
<? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://googleads.googleapis.com/v11/customers/(MANAGER_CUSTOMER_ID):generateKeywordIdeas'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n\n\"keywordSeed\": {\n \"keywords\": [\n \"cofee\"\n ]\n }\n}"); $headers = array(); $headers[] = 'Content-Type: application/json'; $headers[] = 'Login-Customer-Id: (MANAGER_CUSTOMER_ID)'; $headers[] = 'Developer-Token: DEVELOPER_TOKEN'; $headers[] = 'Authorization: Bearer (OAUTH_ACCESS_TOKEN)'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } print_r($result); curl_close($ch);
I'm not getting any output