andeedee / gapi-google-analytics-php-interface

Automatically exported from code.google.com/p/gapi-google-analytics-php-interface
0 stars 0 forks source link

Getting Error Reports #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I Just Filled in my Email hansahrens@gmail.com
2.Then My Password but i just get errors back 
3.

What is the expected output? What do you see instead?
I am getting this error : 

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to
authenticate user. Error: "Request failed, fopen provides no further
information"' in C:\wamp\www\gapi-1.3\gapi.class.php:418 Stack trace: #0
C:\wamp\www\gapi-1.3\gapi.class.php(62):
gapi->authenticateUser('hansahrens@gmai...', 'mypassword') #1
C:\wamp\www\gapi-1.3\example.filter.php(9):
gapi->__construct('hansahrens@gmai...', 'mypassword') #2 {main} thrown in
C:\wamp\www\gapi-1.3\gapi.class.php on line 418

What version of the product are you using? On what operating system?
I am Using the newest Version of Wamp and the newest version of your script.

I have added 2 screenshots 1 of the error and 1 of the file 

Greats,

Hans

Original issue reported on code.google.com by hansahr...@gmail.com on 15 Jun 2009 at 1:18

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Hans,

The fopen() method is designed to allow GAPI to run on production servers that 
cannot
run CURL for some reason. The preferred method, especially for development is 
the
CURL method.

Using the CURL method will give meaningful error messages from Google and give
insight into what is going on here. If you are using WAMP, then you should be 
able to
edit the php.ini file to uncomment the line 'extension=php_curl.dll' by 
removing the ;.

Your php.ini file should be in [wamp install location]/apache/bin/php.ini

Please post the resulting error once you have CURL working if you believe that 
there
is any problems with the GAPI class.

Cheers,
Stig

Original comment by stigmann...@gmail.com on 15 Jun 2009 at 1:27

GoogleCodeExporter commented 9 years ago
Hi Stig,

With your explination everything works like it should work.
I want to thank you very much for your great work on creating/upgrading and
maintaining the GAPI class.

Greets,
hans

Original comment by hansahr...@gmail.com on 15 Jun 2009 at 2:25

GoogleCodeExporter commented 9 years ago
Hi Hans,

With some further testing I have found that you will get the above error from 
fopen
if you do not have the openssl library configured for PHP.

To run GAPI you need either CURL or fopen with openssl. I will update the
instructions for the next release.

Thank you Hans for your support.

Cheers,
Stig

Original comment by stigmann...@gmail.com on 15 Jun 2009 at 10:01

GoogleCodeExporter commented 9 years ago
Hello, 

I'm having a similar problem when trying to run a test script.

If the script uses curl interface, this is the error message:

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to
authenticate user. Error: ""'

and the curl_error() reports connect() timed out!

this is the curl information on php_info.

cURL support        enabled
cURL Information    libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 
libssh2/0.18

On the other hand, when using fopen, this is the message:

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to
authenticate user. Error: "Request failed, fopen provides no further 
information"'

however, the openssl is enabled:

OpenSSL support     enabled
OpenSSL Version     OpenSSL 0.9.8g 19 Oct 2007 

What might be causing this?

Thanks in advance

Original comment by ElTibet...@gmail.com on 18 Mar 2010 at 6:26

GoogleCodeExporter commented 9 years ago
Hello,

Thank you very much for this answer because I had this problem just because I 
work
with WampServer and in my php.ini file the line 'extension=php_curl.dll' was 
comment.
So I just uncomment this line and right now it's work.

Thanks for your support.
Cheers,
Julie

Original comment by juliebon...@gmail.com on 16 May 2010 at 1:35

GoogleCodeExporter commented 9 years ago
Hello,

I try the gapi.class.php on local where i have fopen and openSSL and all works 
but on my hosting they doesnt support openSSL when i try i got:

fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to 
authenticate user. Error: "Request failed, fopen provides no further 
information"' in /www/MW_qPRcycRIG/massimopiccioni.it/Test/gapi.class.php:418 
Stack trace: #0 /www/MW_qPRcycRIG/massimopiccioni.it/Test/gapi.class.php(62): 
gapi->authenticateUser('***USER***', '**PASS***) #1 
/www/MW_qPRcycRIG/massimopiccioni.it/Test/index.php(19): 
gapi->__construct('***USER***', '***USER***') #2 {main} thrown in 
/www/MW_qPRcycRIG/massimopiccioni.it/Test/gapi.class.php on line 418

My hosting told me to open a file to use this function that accept an url and 
return the content of the file but i dont know how to modify the class on this:

 Wrappers x recupero contenuti da URL
 function Get_HTTP_Content($url)
 {
 if( strpos($url,"http://") == 0 )
   $url = preg_replace('/http:\/\//', '', $url, 1);
   $offset = strpos($url,"/");
   if($offset === false)
   {
     $server = $url;
     $file = "/";
   }
   else
   {
     $server = substr($url, 0, $offset);
     $file = substr($url, $offset);
   }
   $cont = "";
   $ip = gethostbyname(trim($server));
   $fp = fsockopen($ip, 80);
   if (!$fp)
     return;
   else
   {
     $query = (
      "GET $file HTTP/1.1\r\n".
      "Accept: */*\r\n".
      "Referer: http://$server\r\n".
      "Accept-Language: it\r\n".
      "Accept-Encoding: none\r\n".
      "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1)\r\n".
      "Host: $server\r\n".
      "Connection: close\r\n\r\n"
     );
     fputs($fp, $query);
     $cont="";
     do
     {
       $cont .= fread($fp, 1024);
     }while (!feof($fp));
     fclose($fp);
     $end_header = strpos($cont, "\r\n\r\n");
     $header = substr($cont, 0, $end_header);
     $body = substr($cont, $end_header + 4);
     if(stripos($header,"Transfer-Encoding: chunked")) $body =
transfer_encoding_chunked_decode($body);
     return $body;
   }
 }
 function transfer_encoding_chunked_decode($in) {
    $out = '';
    while($in != '') {
        $lf_pos = strpos($in, "\012");
        if($lf_pos === false) {
            $out .= $in;
            break;
        }
        $chunk_hex = trim(substr($in, 0, $lf_pos));
        $sc_pos = strpos($chunk_hex, ';');
        if($sc_pos !== false)
            $chunk_hex = substr($chunk_hex, 0, $sc_pos);
        if($chunk_hex == '') {
            $out .= substr($in, 0, $lf_pos);
            $in = substr($in, $lf_pos + 1);
            continue;
        }
        $chunk_len = hexdec($chunk_hex);
        if($chunk_len) {
            $out .= substr($in, $lf_pos + 1, $chunk_len);
            $in = substr($in, $lf_pos + 2 + $chunk_len);
        } else {
            $in = '';
        }
    }
    return $out;
 }

If someone want to fix it for all who have to make run the gapi.class.php on 
hostings that doesnt support SSL.

If i was able to do i would have done and post it but sorry i'm not so good!..:(

Original comment by mail.mas...@gmail.com on 16 Mar 2011 at 7:57

GoogleCodeExporter commented 9 years ago
I am also having the same issues with cURL and libssl installed.

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to 
authenticate user. Error: 
"CaptchaToken=cZPNluM18ObMnGWKU2Zz7v2fdeMlKQDqUr7pxIRneuCz3nresqdwmOzG_5U697uJCo
sMgRV2wL0AvMG4EJmV554-GVJAndtUD-dJm702SkU:IewD55yo0cHLQcSOTGVTfg 
CaptchaUrl=Captcha?ctoken=cZPNluM18ObMnGWKU2Zz7v2fdeMlKQDqUr7pxIRneuCz3nresqdwmO
zG_5U697uJCosMgRV2wL0AvMG4EJmV554-GVJAndtUD-dJm702SkU%3AIewD55yo0cHLQcSOTGVTfg 
Error=CaptchaRequired 
Url=https://www.google.com/accounts/ErrorMsg?Email=clint.grill%40gmail.com&servi
ce=analytics&id=cr&timeStmp=1306286745&secTok=.AG5fkS8XFACXsX47cjM-FSll1gB9alRAS
w%3D%3D "' in /home/lcms/public_html/mpi_includes/gapi/gapi.class.php:418 Stack 
trace: #0 /home/lcms/public_html/mpi_includes/gapi/gapi.class.php(62): 
gapi->authenticateUser('clint.grill@gma...', '******') #1 
/home/lcms/public_html/logic2/web.php(33): 
gapi->__construct('clint.grill@gma...', '******') #2 {main} thrown in 
/home/lcms/public_html/mpi_includes/gapi/gapi.class.php on line 418

phpinfo() gives:
cURL support    enabled
cURL Information    libcurl/7.21.0 OpenSSL/0.9.8i zlib/1.2.3 libidn/0.6.5 

OpenSSL support     enabled
OpenSSL Version     OpenSSL 0.9.8i 15 Sep 2008 

curl is not in safemode_disabled list and there is no overwriting ini file.

any ideas?

Original comment by clint.gr...@gmail.com on 25 May 2011 at 1:32

GoogleCodeExporter commented 9 years ago
After checking issue 14, I solved my problem by doing a google captchaunlock.

Original comment by clint.gr...@gmail.com on 25 May 2011 at 1:50

GoogleCodeExporter commented 9 years ago
I also have same error .. in localhost i changed php.ini file then it worked 
fine ..when i trsnsfer same files to my hosting site then it gives back the 
same error

Original comment by koneruka...@gmail.com on 7 Jun 2011 at 1:14

GoogleCodeExporter commented 9 years ago
i can't use curl and fopen() still gives me Fatal error: Uncaught exception 
'Exception' with message 'GAPI: Failed to authenticate user. Error: "Request 
failed...what sould I do?

Original comment by legod...@gmail.com on 10 Nov 2011 at 4:43

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You need to create application specific password in order to access it 

  https://accounts.google.com/b/0/IssuedAuthSubTokens#accesscodes 

Create a new password by typing Analytics in the input box and use that 
password , it will work..

Original comment by virk.off...@gmail.com on 28 Jan 2012 at 11:21