php-general Digest 10 Aug 2008 23:37:31 -0000 Issue 5617
Topics (messages 277945 through 277957):
Re: Send a cookie with a file_get_contents( ) request?
277945 by: Carlos Medina
277946 by: Anders Norrbring
277947 by: Jim Lucas
277948 by: Anders Norrbring
Re: being professional about IT. (was: An appeal to your better nature)
277949 by: Bastien Koert
News reader
277950 by: Alain Roger
277951 by: Al
277952 by: Alain Roger
277953 by: Al
277954 by: Alain Roger
277955 by: Alain Roger
277956 by: Alain Roger
Re: how to curl
277957 by: Nathan Nobbe
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Anders Norrbring schrieb:
I have a web site where I use cookies to store logins, and also session
cookies for users logged in.
Is there a way for me to use file_get_contents() to pull content which are
"behind" the login?
In other words, I want to use my own log-in cookie and somehow send it with
the file_get_contents request to get the content.
Can I somehow do this? Or are there other ways?
Anders.
I dont know what you mean with "behind the Login", but if you want to
request extern content with authentication, use CURL extension to do
this. Other way is, use Frames on your site, to load extern content.
Regards
Carlos
--- End Message ---
--- Begin Message ---
> Anders Norrbring wrote:
>
> > Thanks Per,
> > I think so too, I glanced it, but unfortunately I have no idea
> > whatsoever about *how* to do it... So, if anyone have suggestions, or
> > concrete examples, please do share!
> >
> > Anders.
>
> I did play around with it once, but I don't have any actual code to
> share. Try this though:
>
> $opts = array(
> 'http'=>array(
> 'method'=>"GET",
> 'header'=>"Accept-language: en\r\n".
> "Cookie: foo=bar\r\n"
> )
> );
>
> $context = stream_context_create($opts);
>
> $result=file_get_contents( <url>, FILE_TEXT, $context );
>
>
> /Per Jessen, Zürich
I'm doing just that now.. ;-)
However, I have 3 parameters set in the cookie, so the question is how to
include them all three...
Should I repeat the "Cookie: foo=bar\r\n" three times, like:
"Cookie: foo=bar\r\n" .
"Cookie: bar=else\r\n" .
"Cookie: time=number\r\n"
Or would I, in some way, add all three on one "Cookie:" line? If so, how do I
delimit them? I haven't been doing much with http headers, so all of this is
pure experimenting for me..
Anders.
--- End Message ---
--- Begin Message ---
Anders Norrbring wrote:
Anders Norrbring wrote:
Thanks Per,
I think so too, I glanced it, but unfortunately I have no idea
whatsoever about *how* to do it... So, if anyone have suggestions, or
concrete examples, please do share!
Anders.
I did play around with it once, but I don't have any actual code to
share. Try this though:
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n".
"Cookie: foo=bar\r\n"
)
);
$context = stream_context_create($opts);
$result=file_get_contents( <url>, FILE_TEXT, $context );
/Per Jessen, Zürich
I'm doing just that now.. ;-)
However, I have 3 parameters set in the cookie, so the question is how to
include them all three...
Should I repeat the "Cookie: foo=bar\r\n" three times, like:
"Cookie: foo=bar\r\n" .
"Cookie: bar=else\r\n" .
"Cookie: time=number\r\n"
Or would I, in some way, add all three on one "Cookie:" line? If so, how do I
delimit them? I haven't been doing much with http headers, so all of this is pure
experimenting for me..
Anders.
If I recall correctly, you have to have them encoded, plus use a semi-colon to separate them. So
something like this.
"Cookie: foo=bar; bar=else; time=number\r\n";
Check out the RFC for it. http://www.w3.org/Protocols/rfc2109/rfc2109.txt
Look at section 5.1, example #7. That should answer your question(s) about
cookies.
Jim
--- End Message ---
--- Begin Message ---
> -----Ursprungligt meddelande-----
> Från: Jim Lucas [mailto:[EMAIL PROTECTED]
> Skickat: den 10 augusti 2008 10:56
> Till: Anders Norrbring
> Kopia: 'Per Jessen'; [EMAIL PROTECTED]
> Ämne: Re: SV: SV: [PHP] Send a cookie with a file_get_contents( )
> request?
>
> Anders Norrbring wrote:
> >> Anders Norrbring wrote:
> >>
> >>> Thanks Per,
> >>> I think so too, I glanced it, but unfortunately I have no idea
> >>> whatsoever about *how* to do it... So, if anyone have suggestions,
> or
> >>> concrete examples, please do share!
> >>>
> >>> Anders.
> >> I did play around with it once, but I don't have any actual code to
> >> share. Try this though:
> >>
> >> $opts = array(
> >> 'http'=>array(
> >> 'method'=>"GET",
> >> 'header'=>"Accept-language: en\r\n".
> >> "Cookie: foo=bar\r\n"
> >> )
> >> );
> >>
> >> $context = stream_context_create($opts);
> >>
> >> $result=file_get_contents( <url>, FILE_TEXT, $context );
> >>
> >>
> >> /Per Jessen, Zürich
> >
> >
> > I'm doing just that now.. ;-)
> > However, I have 3 parameters set in the cookie, so the question is
> how to include them all three...
> > Should I repeat the "Cookie: foo=bar\r\n" three times, like:
> >
> > "Cookie: foo=bar\r\n" .
> > "Cookie: bar=else\r\n" .
> > "Cookie: time=number\r\n"
> >
> > Or would I, in some way, add all three on one "Cookie:" line? If so,
> how do I delimit them? I haven't been doing much with http headers, so
> all of this is pure experimenting for me..
> >
> > Anders.
> >
> >
>
> If I recall correctly, you have to have them encoded, plus use a semi-
> colon to separate them. So
> something like this.
>
> "Cookie: foo=bar; bar=else; time=number\r\n";
>
> Check out the RFC for it.
> http://www.w3.org/Protocols/rfc2109/rfc2109.txt
>
> Look at section 5.1, example #7. That should answer your question(s)
> about cookies.
Thanks!
Actually, I found that just at the same time as your reply went into the
mailbox.. ;-)
I'll do a test to see if I can get it right..
Thanks a lot to you all!
Anders.
--- End Message ---
--- Begin Message ---
On Wed, Aug 6, 2008 at 9:38 AM, Chris Haensel <[EMAIL PROTECTED]>wrote:
>
> Chris Haensel wrote:
>
> > I never thought someone seriously would go the whole way from dev,
> > test and prod servers AND use all the version control stuff.
>
> Oh, it's done quite a lot, I can assure you.
>
> > And being a "good IT professional" to me means: know what
> > you're doing, and take the hits you get.
>
> When the hits become expensive, your thinking will change. If every
> hour of downtime is EUR100K lost, you don't take the hits you get, you
> make sure you don't get hit :-)
>
>
> /Per Jessen, Zürich
>
> Okay, that is a point I can take :o)
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Version/source control and change management are huge issues in many
companies. They will require extensive testing to be done before that code
ever makes it production. Bringing down production webservers or databases
can impact other areas of the business. I work with some of the biggest
retailers in the world and it would kill the company to have affected/bring
down a production system. If that happens, and it has, we run day and night
with all sorts of folks from the client to analyze, correct and re-roll
code if needed.
Believe me, no one rolls code without a plan to back it out, in cases its
bad code, and never without approval from other stakeholders in the business
like the webserver people, database people, directors etc.
--
Bastien
Cat, the other other white meat
--- End Message ---
--- Begin Message ---
Hi,
i tried to configure Thunderbird to read and post news on PHP.net forums.
I'm able to read messages but not to post some.
Does anyone already succeed in it ?
Do to security reasons at work, personal email usage is strictly forbidden
now so i'm not able to use gmail, yahoo or hotmail anymore.
thanks a lot
--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
--- End Message ---
--- Begin Message ---
Alain Roger wrote:
Hi,
i tried to configure Thunderbird to read and post news on PHP.net forums.
I'm able to read messages but not to post some.
Does anyone already succeed in it ?
Do to security reasons at work, personal email usage is strictly forbidden
now so i'm not able to use gmail, yahoo or hotmail anymore.
thanks a lot
Create a new account
Select newsgroup
enter news.php.net
I used Thunderbird for this message.
--- End Message ---
--- Begin Message ---
this is what i've done even at home but sending message fails everytime.
even if my SMTP server is well configured :-(
On Sun, Aug 10, 2008 at 8:33 PM, Al <[EMAIL PROTECTED]> wrote:
>
>
> Alain Roger wrote:
>
>> Hi,
>>
>> i tried to configure Thunderbird to read and post news on PHP.net forums.
>> I'm able to read messages but not to post some.
>>
>> Does anyone already succeed in it ?
>> Do to security reasons at work, personal email usage is strictly forbidden
>> now so i'm not able to use gmail, yahoo or hotmail anymore.
>>
>> thanks a lot
>>
>>
> Create a new account
> Select newsgroup
> enter news.php.net
>
> I used Thunderbird for this message.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
--- End Message ---
--- Begin Message ---
Port 119?
Try your ISP mail account directly. Maybe gmail is blocking you.
Can you access and other newsgroups?
You'd be better off working with the Thunderbird forum for this problem. It's
not a php problem.
Alain Roger wrote:
this is what i've done even at home but sending message fails everytime.
even if my SMTP server is well configured :-(
On Sun, Aug 10, 2008 at 8:33 PM, Al <[EMAIL PROTECTED]> wrote:
Alain Roger wrote:
Hi,
i tried to configure Thunderbird to read and post news on PHP.net forums.
I'm able to read messages but not to post some.
Does anyone already succeed in it ?
Do to security reasons at work, personal email usage is strictly forbidden
now so i'm not able to use gmail, yahoo or hotmail anymore.
thanks a lot
Create a new account
Select newsgroup
enter news.php.net
I used Thunderbird for this message.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
yes on port 119.
i do not want to use my professional email address (or SMTP settings) to
send message on newsgroups.
for MS, Borland, eclipse and other newsgroups servers, it works perfectly
without setting a SMTP server.
i do not use gmail to send message via thunderbird... i use gmail only for
mailing list as thunderbird does not work :-(
On Sun, Aug 10, 2008 at 9:01 PM, Al <[EMAIL PROTECTED]> wrote:
> Port 119?
>
> Try your ISP mail account directly. Maybe gmail is blocking you.
>
> Can you access and other newsgroups?
>
> You'd be better off working with the Thunderbird forum for this problem.
> It's not a php problem.
>
>
> Alain Roger wrote:
>
>> this is what i've done even at home but sending message fails everytime.
>> even if my SMTP server is well configured :-(
>>
>> On Sun, Aug 10, 2008 at 8:33 PM, Al <[EMAIL PROTECTED]> wrote:
>>
>>
>>> Alain Roger wrote:
>>>
>>> Hi,
>>>>
>>>> i tried to configure Thunderbird to read and post news on PHP.net
>>>> forums.
>>>> I'm able to read messages but not to post some.
>>>>
>>>> Does anyone already succeed in it ?
>>>> Do to security reasons at work, personal email usage is strictly
>>>> forbidden
>>>> now so i'm not able to use gmail, yahoo or hotmail anymore.
>>>>
>>>> thanks a lot
>>>>
>>>>
>>>> Create a new account
>>> Select newsgroup
>>> enter news.php.net
>>>
>>> I used Thunderbird for this message.
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>
>>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
--- End Message ---
--- Begin Message ---
if i use a real email address and SMTP from my real server, it works.
but not with email address [EMAIL PROTECTED] :-(
Alain Roger wrote:
yes on port 119.
i do not want to use my professional email address (or SMTP settings) to
send message on newsgroups.
for MS, Borland, eclipse and other newsgroups servers, it works perfectly
without setting a SMTP server.
i do not use gmail to send message via thunderbird... i use gmail only for
mailing list as thunderbird does not work :-(
On Sun, Aug 10, 2008 at 9:01 PM, Al <[EMAIL PROTECTED]> wrote:
Port 119?
Try your ISP mail account directly. Maybe gmail is blocking you.
Can you access and other newsgroups?
You'd be better off working with the Thunderbird forum for this problem.
It's not a php problem.
Alain Roger wrote:
this is what i've done even at home but sending message fails everytime.
even if my SMTP server is well configured :-(
On Sun, Aug 10, 2008 at 8:33 PM, Al <[EMAIL PROTECTED]> wrote:
Alain Roger wrote:
Hi,
i tried to configure Thunderbird to read and post news on PHP.net
forums.
I'm able to read messages but not to post some.
Does anyone already succeed in it ?
Do to security reasons at work, personal email usage is strictly
forbidden
now so i'm not able to use gmail, yahoo or hotmail anymore.
thanks a lot
Create a new account
Select newsgroup
enter news.php.net
I used Thunderbird for this message.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
it seems that news.php.net server is checking if address is real or a
fake...
at least it is checking if user's address is registered into their
mailing list or if there are some keywords from filter like: fake,
noemail, nospam,...
now it works :-)
Alain R. wrote:
if i use a real email address and SMTP from my real server, it works.
but not with email address [EMAIL PROTECTED] :-(
Alain Roger wrote:
yes on port 119.
i do not want to use my professional email address (or SMTP settings) to
send message on newsgroups.
for MS, Borland, eclipse and other newsgroups servers, it works perfectly
without setting a SMTP server.
i do not use gmail to send message via thunderbird... i use gmail only
for
mailing list as thunderbird does not work :-(
On Sun, Aug 10, 2008 at 9:01 PM, Al <[EMAIL PROTECTED]> wrote:
Port 119?
Try your ISP mail account directly. Maybe gmail is blocking you.
Can you access and other newsgroups?
You'd be better off working with the Thunderbird forum for this problem.
It's not a php problem.
Alain Roger wrote:
this is what i've done even at home but sending message fails
everytime.
even if my SMTP server is well configured :-(
On Sun, Aug 10, 2008 at 8:33 PM, Al <[EMAIL PROTECTED]> wrote:
Alain Roger wrote:
Hi,
i tried to configure Thunderbird to read and post news on PHP.net
forums.
I'm able to read messages but not to post some.
Does anyone already succeed in it ?
Do to security reasons at work, personal email usage is strictly
forbidden
now so i'm not able to use gmail, yahoo or hotmail anymore.
thanks a lot
Create a new account
Select newsgroup
enter news.php.net
I used Thunderbird for this message.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Sat, Aug 9, 2008 at 8:11 AM, mukesh yadav <[EMAIL PROTECTED]> wrote:
>
>>
>> remember, serverB should be speaking http. were you unable to understand
>> its usage looking at the manual,
>>
>>
>
> Yes nathan i'm not able to understand how to pass the sql query can you
> give me one small eg.
>
> like
>
> $sql = select * from table where id = $var ;
>
> how i'll send this query using cURL to get the result. from remote server.
>
> in manual i'm not able to find the way query executes.
>
> thanks
>
mukesh,
im happy to respond, but please keep the conversation on the list, so that
others may benefit by having it available in the archives.
i have a few questions as well; is the query being executed on the provider
system (that is the one you intend to send the http request to)? also, are
you writing and deploying code to both of these systems, or just on the
consumer (the one you intend to execute the curl request from)?
either way, i can say that programmatic http interfaces are usually built to
deliver services, such as an api for an online application. these
interfaces offer methods much like those in php (or many other languages),
they take a well defined set of argumets, and have a well defined return
value.
in your case, i would expect the provider to expose some url that would
essentially represent the query you intend to execute. it would then expect
the consumer to provide an id during the request, so that it can use that in
the query. then it would return the result, nearly verbatim from the
database.
so, if the provider supported the method as http GET, you might see
something like this, which you would execute via curl,
http://myrestapi.com/getAllFromTable?id=56
then, the provider would grab the id right out of $_GET (if it were also
written in php).
-nathan
--- End Message ---