cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Curl and php

From: haroon ahmad <haroon_at_fastcreators.com>
Date: Fri, 29 Jun 2007 10:38:37 +0500

Hi

are you using

curl_setopt ($ch, CURLOPT_GET, 1);
for your GET post?

Regards,
Haroon Ahmad
Sr. Web Developer
www.fastcreators.com

On 6/29/07, tfc_at_21stcenturycompany.com <tfc_at_21stcenturycompany.com> wrote:
>
> * I am wondering how to do both a post and get request with curl
> in the same session.
>
> I need to post the user id and password to https:// url#1
> and then get the XML data from https://url#2 <https://url/#2>
>
>
> I am able to perform the post successfully but get and invalid session
> response on the get request.
>
> // INIT CURL
> $ch = curl_init();
>
> // SET URL FOR THE POST FORM LOGIN
> curl_setopt($ch, CURLOPT_URL, 'https:// url ');
> curl_setopt($ch, CUPROPT_SSL_VERIFYPEER, FALSE);
> curl_setopt($ch, CUPROPT_SSL_VERIFYHOST, FALSE);
>
> // ENABLE HTTP POST
> curl_setopt ($ch, CURLOPT_POST, 1);
>
> // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
> curl_setopt ($ch, CURLOPT_POSTFIELDS,
> 'userid=fieldvalue1&password=fieldvalue2');
> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
>
> // EXECUTE 1st REQUEST (LOGIN)
> $postresponse = curl_exec ($ch);
> echo $postresponse
>
> // SET FILE TO DOWNLOAD
> curl_setopt($ch, CURLOPT_URL, '
> https:// <https://f/> url#2 for xml data');
>
> // EXECUTE 2nd REQUEST (xml response)
> $getresponse = curl_exec ($ch);*
> echo $getresponse;
>
> // CLOSE THE SESSION
> curl_close($ch);
> **
> Bob
> Twenty-First Century
> website: http://www.21stcenturycompany.com
> email: tfc_at_21stcenturycompany.com
> phone: (888) 961-6677
> fax: (805) 964-5007
> *
> Twenty-First Century
> website: http://www.21stcenturycompany.com
> email: tfc_at_21stcenturycompany.com
> phone: (888) 961-6677
> fax: (805) 964-5007
>
>
>
> *
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-06-29