RE: [PHP] Passing Credentials
| From: | Albert | Date: | Thu, 02 Feb 2006 06:07:01 +0000 |
| Subject: | RE: [PHP] Passing Credentials | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229694@lists.php.net to get a copy of this message | ||
News1 wrote:
> Thanks for all of the input! I have tried a new tactic, using CURL. I've
> had some success with grabbing a web page, but when I try to pass
> credentials, I get an error. I tried following examples from various
> sites (which all had different implementations), but I was unsuccessful.
>
>Here is the file I came up with:
1 <?php
2 $ch = curl_init();
3 curl_setopt($ch, CURLOPT_URL, "http://www.example.com");
4 curl_setopt($ch, CURLOPT_HEADER, 1);
5 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
6 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
7 curl_setopt($ch, CURLOPT_USERPWD, 'user:password')
8 curl_exec($ch);
9 curl_close($ch);
10 ?>
> I get the following error:
> Parse error: parse error in /var/www/html/sess6.php on line 8
> If anyone has a suggestion, I would greatly appreciate it.
I've added line numbers to your code. Now look at the end of line 7. You
will see a missing ;. This is probably your parse error.
Albert
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.25/247 - Release Date: 2006/01/31