Re: Gmail / RSS accessing from script

From: Date: Thu, 09 Nov 2006 04:06:51 +0000
Subject: Re: Gmail / RSS accessing from script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-244416@lists.php.net to get a copy of this message
Chris Ditty wrote:
I am trying to write a small module to display my gmail email on my custom startup page. I am using this url with the correct userid and password - https://USERNAME:PASSWORD@gmail.google.com/gmail/feed/atom . When I put it in the web browser, it acts like it is supposed to. But when I try and script it, it returns a 401 unauthorized error. I get the same error when I try a wget also. Has anyone had any success in getting this to work from a script? The output is supposed to be simple RSS once I get past this error.
I'm only guessing, but you probably need to set the http Authorization header in the request. If you are using curl, do something like: curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, "USERNAME:PASSWORD"); Check out wget's --http-user and --http-password options too. Ryan

« previous php.general (#244416) next »