php-general Digest 11 Aug 2008 12:26:54 -0000 Issue 5618
Topics (messages 277958 through 277961):
Re: Send a cookie with a file_get_contents( ) request?
277958 by: Anders Norrbring
277960 by: Per Jessen
Re: how to curl
277959 by: mukesh yadav
newsletter code
277961 by: Angelo Zanetti
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 ---
> > -----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.
Just wanted to let you know that these ideas worked out.. ;-)
Per's example, combined with Jim's delimiter hint was just right. Works perfect!
Thanks to you guys!
Anders.
--- End Message ---
--- Begin Message ---
Anders Norrbring wrote:
> Just wanted to let you know that these ideas worked out.. ;-)
> Per's example, combined with Jim's delimiter hint was just right.
> Works perfect!
Good stuff - but I can't take credit for the example, I just borrowed
that from the manual.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
>
>
>
> 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.
>
Hey I dint realize that the question is going only to you.
>
> 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)?
>
Yes I'm doing on the both the server. And when a consumer server will send
the query to provider's server the query will execute on provider server and
then it will pass the result to the consumer's server. Its just like a
Registration of the key. where consumer will check for the right key on the
provider's server.
> 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
>
Since I'm trying to do on both side, so I'll provide the http GET method.
can you please give small e.g. for both side.
thank you
--- End Message ---
--- Begin Message ---
Hi All,
I have a question related to newsletter subscriptions to websites as well as
sending out of the newsletters.
Here is the scenario:
Client wants a "subscribe to newsletter" dialog on website, typically just
an email address.
Then in his admin section he wants to send out HTML newsletters/plain text
depending on the user's email client.
Now how would I go about creating the newsletter in the backend? Using a
WSIWIG editor? Or is there some code that you guys use as there are also
things to consider such as:
-bulk mailing, instead of sending many mails at once. Rather send out some
scheduled emails
-Plain text vs HTML email
Etc...
What do you guys use if you are building a custom web app?
I have seen Webinsta before it works well but it's a separate system.
Let me know,
Thanks
Kind regards
Angelo
Web: http://www.elemental.co.za
--- End Message ---