Martialdelastic / google-api-adwords-php

Automatically exported from code.google.com/p/google-api-adwords-php
Apache License 2.0
0 stars 0 forks source link

PHP integer handling #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
criterionId is larger than int. I am now sure if this issues is related to
the API or PHP library. I am adding ad paramaters to my keywords when I
send criterionId 5436755087 I receve and error that criterionId 2147483647
 is not valid. I have attached the error in a text file.

-Ryan Bantz

Original issue reported on code.google.com by ryanbant...@gtempaccount.com on 8 Dec 2009 at 5:14

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for reporting this.  Which version of the library and which version 
of PHP 
are you using?  Can you also include a snippet of your code that creates the 
objects 
makes this request?

Best,
- Eric Koleda, AdWords API Team

Original comment by adwordsa...@google.com on 8 Dec 2009 at 5:22

GoogleCodeExporter commented 8 years ago
Thanks for the quick response Eric!

I am running 1.2.0 of the library and PHP 5.2.

      while ($row = mysql_fetch_assoc($result)) {
        // Create ad params.

        $adParam1 = new AdParam($row['adgroup_id'], $row['criterion_id'], "$" .
round($row['price'], 0), 1);

        $operations = array(new AdParamOperation($adParam1, 'SET'));

        // Set ad params.
        $adParam = $adParamService->mutate($operations);
        //die(print_r($adParam));

      }

Original comment by ryanbant...@gtempaccount.com on 8 Dec 2009 at 5:32

GoogleCodeExporter commented 8 years ago
In testing we've found that the different versions of PHP 5.2 behave very 
differently.  
Which specific build of PHP are you using?

Original comment by adwordsa...@google.com on 8 Dec 2009 at 5:59

GoogleCodeExporter commented 8 years ago
5.2.10-2ubuntu6.3

Original comment by ryanbant...@gtempaccount.com on 8 Dec 2009 at 6:01

GoogleCodeExporter commented 8 years ago
Hello Eric,

I was able to get my script working. It looks like some how the library was
interpreting as an integer and couldn't handle that large of a number. I cast 
the
criterionid as a float and everything appears to work now. I have included the
updated line below.

$adParam1 = new AdParam($row['adgroup_id'], (float) $row['criterion_id'], "$" .
round($row['price'], 0), 1);

-Ryan Bantz
MRB Networks 

Original comment by ryanbant...@gtempaccount.com on 8 Dec 2009 at 10:12

GoogleCodeExporter commented 8 years ago
Hi Ryan,

Thanks for the feedback.  From the initial research it seemed to be an integer 
conversion issue, and I'm glad casting as a float solved the issue.  We will 
investigate this further to determine if changes can be made to the client 
library to 
prevent this in the future.

Best,
- Eric

Original comment by adwordsa...@google.com on 9 Dec 2009 at 2:48

GoogleCodeExporter commented 8 years ago

Original comment by api.ekol...@gmail.com on 9 Dec 2009 at 11:38

GoogleCodeExporter commented 8 years ago

Original comment by api.ekol...@gmail.com on 17 Dec 2009 at 9:00

GoogleCodeExporter commented 8 years ago
Issue 10 has been merged into this issue.

Original comment by api.ekol...@gmail.com on 4 Jan 2010 at 6:05

GoogleCodeExporter commented 8 years ago
Issue 17 has been merged into this issue.

Original comment by api.ekol...@gmail.com on 17 Mar 2010 at 1:53

GoogleCodeExporter commented 8 years ago
i have same problem. how can i fix. i tried "check clienEmail", "(float) 
criterionId", "reenter keywords"

Original comment by akar...@gmail.com on 29 Jun 2010 at 4:28

GoogleCodeExporter commented 8 years ago
Hi,

Explicitly casting your ID to a float before passing it into the service 
usually fixes the issue.  What version of PHP are you using?

- Eric

Original comment by api.ekol...@gmail.com on 29 Jun 2010 at 5:42

GoogleCodeExporter commented 8 years ago
Hi,

PHP Version is 5.2.9

i tryed convert id to float but cant fix problem. 

below listing group and criterion ids.
Ad group criterion with ad group id "1545265232", criterion id "5304064465, and 
type "Keyword" was found.
Ad group criterion with ad group id "1545265232", criterion id "11350382259, 
and type "Keyword" was found.

this one is run no problem.
$adGroupId = (float) '1545265232';
$criterionId = (float) '5304064465';
$adParam1 = new AdParam($adGroupId, $criterionId, '66.30', 1);

but this one is not.
$adGroupId = (float) '1545265232';
$criterionId = (float) '11350382259';
$adParam1 = new AdParam($adGroupId, $criterionId, '66.30', 1);

and gives INVALID_ADGROUP_CRITERION_SPECIFIED.

first keyword's id 10 digits second one 11 digits.

thank you.

Original comment by akar...@gmail.com on 30 Jun 2010 at 7:47

GoogleCodeExporter commented 8 years ago
hi,
2 days and no answer. please help.

Original comment by akar...@gmail.com on 2 Jul 2010 at 7:45

GoogleCodeExporter commented 8 years ago
Can you post the SOAP XML request and response?  From looking at the logs it 
appears that the values are being passed correctly, and that the server 
believes that this ad group and criterion pairing is invalid.

Original comment by api.ekol...@gmail.com on 2 Jul 2010 at 4:06

GoogleCodeExporter commented 8 years ago
Hello,
Thank you for answer.

Problem fixed.
The problem was using one more client accounts for keywords. 
We solved problem by creating a new campaign and we recreated new adgroups and 
keywords using one client account. Now I can set ad param for all keywords.

Original comment by akar...@gmail.com on 2 Jul 2010 at 4:38

GoogleCodeExporter commented 8 years ago
likely related when Estimated daily cost is sometimes larger than an int for 
example running the example code GetTrafficEstimates.php on cars produces the 
following output: 

Results for the keyword with text 'cars' and match type 'BROAD':
  Estimated average CPC: 735551
  Estimated ad position: 2.44 
  Estimated daily clicks: 73
  Estimated daily cost: 56066670

Results for the keyword with text 'cars' and match type 'PHRASE':
  Estimated average CPC: 737858
  Estimated ad position: 2.50 
  Estimated daily clicks: 9462
  Estimated daily cost: -1388161792

Results for the keyword with text 'cars' and match type 'EXACT':
  Estimated average CPC: 811483
  Estimated ad position: 3.04 
  Estimated daily clicks: 340
  Estimated daily cost: 283101864

Original comment by webpag...@gmail.com on 30 Nov 2010 at 10:18

GoogleCodeExporter commented 8 years ago
In that case the problem could be just the display.  If you change the printf() 
string to use %f or %s does it output the correct number?

printf("  Estimated daily cost: %f\n\n", $meanTotalCost);

Original comment by api.ekol...@gmail.com on 30 Nov 2010 at 10:41

GoogleCodeExporter commented 8 years ago
That was the problem, thank you for your help.

Original comment by webpag...@gmail.com on 1 Dec 2010 at 6:14

GoogleCodeExporter commented 8 years ago
I'll update the examples to use %.0f for long values.

Original comment by api.ekol...@gmail.com on 1 Dec 2010 at 7:37

GoogleCodeExporter commented 8 years ago

Original comment by ekoleda+devrel@googlers.com on 11 Apr 2011 at 8:30

GoogleCodeExporter commented 8 years ago
Issue 55 has been merged into this issue.

Original comment by ekoleda+devrel@googlers.com on 11 Apr 2011 at 8:31