Richard Lynch | 1 Jan 19:30 2008

Re: Using POST and POSTFIELDS with CURL

On Mon, December 24, 2007 9:09 am, tpieretti <at> aol.com wrote:
> $randnum = rand(1,9999999);
> curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookiejar-$randnum");
> curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookiejar-$randnum");

The problem here is possibly that you are storing the cookies in some
different random file each time.

The application may be using those cookies to track users, and require
a 2-stage operation -- So you may need to visit a different page first
to get a valid Cookie, and THEN use those cookies as part of this
request to get what you want.

Try storing the cookies in the same file/jar all the time, and also
see if you can close your browser, surf DIRECTLY to the URL, and have
it work or not.

--

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Richard Lynch | 1 Jan 19:34 2008

Re: 302 issue

Perhaps try turning off/on FOLLOWLOCATION and seeing where the headers
are trying to bounce you.

I'm guessing you'll end up seeing some Cookies in the headers, and
you'll need to use COOKIEJAR and COOKIEFILE.

On Tue, December 11, 2007 12:41 am, Shallway Xu wrote:
> hi guys,
> I was trying to exchange google single use tokens with curl&php.
> ----------------------------------------------------------
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, '
> http://www.google.com/accounts/AuthSubSessionToken');
> curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: AuthSub
> token=$token", "X-Google-Key: key=$devkey"));
> curl_exec($ch);
> curl_close($ch);
> ----------------------------------------------------------
> After execution, I got this on the page:
> ----------------------------------------------------------
> Moved Temporarily The document has moved
> here<https://www.google.com/accounts/AuthSubSessionToken>
> .
>
> --------------------------------------------------------------
> And I can't see any request and responses from curl&php.
> Did I miss something on this? Thank you.
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
(Continue reading)

Richard Lynch | 1 Jan 19:36 2008

Re: Problem with redirection

On Mon, December 17, 2007 9:34 am, Werner Hofer wrote:
> I would like to use the curl library. I wish to get a content from a
> page
> (page x: http://www.travelan.net/module/20316/more-gesamt/).
> For that i call a page (page y:
> http://www.getyourstock.com/alfa13.php) and
> this page calls page x (see the example alfa13.php).
> Now the problem is following: There is an redirection whitin page x
> and i do
> not know how to get the content of the redirected page x
> The content of the redirected page x should be displayed finally in
> the
> browser.
> Result: I only get the header, but not the content of the page
> itselfs.
>
> The header i get is following:
>
> HTTP/1.1 302 Found Date: Mon, 17 Dec 2007 15:20:17 GMT Server:
> Apache/2.0.54
> (Debian GNU/Linux) PHP/5.2.3 with Suhosin-Patch DAV/2 mod_ssl/2.0.54
> OpenSSL/0.9.7e X-Powered-By: PHP/5.2.3 Set-Cookie:
> PHPSESSID=1vmqk1rfjgau42pvki54kl8je5; path=/ Expires: Thu, 19 Nov 1981
> 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate,
> post-check=0, pre-check=0 Pragma: no-cache location:
> http://www.holidayandmore.de/index.asp?Agentur=50376&AgentID=20316
> Transfer-Encoding: chunked Content-Type: text/html

Since you are getting cookies in the headers, perhaps you need to
provide a COOKIEJAR and COOKIEFILE for the redirects to work.
(Continue reading)

Richard Lynch | 2 Jan 00:36 2008

Re: CURL plain text content without images or flash movies

On Fri, December 28, 2007 5:28 am, Joe wrote:
> I need to CURL a website with some important plain text information
> but
> it also has a lot of useless longloading images and flash movies on it
> which I really do not need. To reduce load on my server and also on
> the
> server I am CURLing to, I am searching for a way to CURL just for the
> plain text source code of the website and to avoid CURLing for the
> useless images and flash movies also on this site.

You'll have to do extra work to GET the movies and images, actually...

So cURL does what you want, out of the box. :-)

--

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Richard Lynch | 2 Jan 00:38 2008

Re: cURL problem, nothing appear in the page

On Sat, December 22, 2007 9:50 pm, Douglas Fonseca wrote:
> Please, I need help!
> I installed cURL library for php5 on my Ubuntu Linux. Everything looks
> OK.
> When I open phpinfo() page the cURL is listed as installed and OK:
> curl cURL support enabled cURL Information libcurl/7.15.5
> OpenSSL/0.9.8c
> zlib/1.2.3 libidn/0.6.5
> But, when I do a page using cURL like:
>
> <?php
> $url = "http://www.google.com";
> $ch = curl_init();

if (!$ch) die("NO CURL HANDLE?!");

> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_URL, $url);
> $result = curl_exec($ch);
> curl_close($ch);
> echo $result;
> ?>
>
> it does'nt work! When I open my Browser and try to apen the page, the
> page
> opens, but with nothing in it!! Completely emply. No errors, no google
> page,
> no contents. Nothing!
> Please, with someone could help me, thank you!!

(Continue reading)

Richard Lynch | 2 Jan 00:42 2008

Re: simulateous POST and GET request

On Sat, December 8, 2007 12:08 am, Rodik wrote:
> I need to make POST and GET requests simulateously, but it seems that
> curl doesn't support posting data to url with get data. I tryed to set
> both CURLOPT_HTTPGET and CURLOPT_POST but it didn't work.
> For example I need to POST var2=var2 to
> http://www.example.com/index.php?var1=var1.

What happens if you use the GET parameters just as part of the URL
with CURLOPT_URL ?...

--

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Richard Lynch | 2 Jan 00:44 2008

Re: cURL opt is not correct or missing?

Since nobody has answered yet, I'll take a stab:

Is the Cookie file readable/writable by the PHP user?

The missing cookies would almost for sure make the script not work...

On Tue, November 27, 2007 11:18 pm, David Colter wrote:
> I'm really new to cURL, but have been reading everywhere I can for the
> solution to my problem. So far the understanding evades me.
>
> I am trying to get data from my companies website that requires a user
> id and password. I think I've written the code to get beyond the entry
> page and download the resulting page, but that is not being returned.
> So, I think that I'm missing something in the pages Method or the
> ASPSESSION is not being handled by cURL. Does this occur when the form
> is not correctly sent/received? Incidentally, no cookies are being
> written. I think there's a problem with 'targetURL' being part of
> $form_data. Another part of the confusion results from what I can see
> being sent by using HTTP Headers (Firefox extension) The first bit of
> headers I captured:
>
> https://www.aapilots.com/public/flash/login.asp
>
> GET /public/flash/login.asp HTTP/1.1
> Host: www.aapilots.com
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
> rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12
> Accept:
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
(Continue reading)

Richard Lynch | 2 Jan 00:51 2008

Re: Quotes: Single, double, and NONE

On Sat, October 27, 2007 9:40 am, Colleen R. Dick wrote:

I realize I'm WAY behind, but...

> People:
> Back to PHP basics: PHP is flawed but not *THAT* flawed.
> (apologies to most of you who know this) here is how it rolls.
> Double quotes and single treat embedded variables differently.
> "foo" and 'foo' happen to be the same because
> there is no variable in it.  For this reason single quotes are more
> efficient.

Single-quotes are not significantly more efficient than double quotes.

Note that single-quotes STILL have some special characters:
\'
\\
So the parser has to iterate over each character with a 1-char
look-ahead (or look-behind) to know what to do.

Double-quotes has a slightly larger 'switch' statement for what to
*DO* with the special characters, but that's not a significant time
savings.

The "single-quotes is faster" answer is essentially an urban legend. :-)

--

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
(Continue reading)

Douglas Fonseca | 3 Jan 19:01 2008
Picon

Re: Problem with redirection

Hi,
I'm with the same problem.
I'm trying to log in on orkut with cURL, it works, but don't redirects de page to Orkut Home, just show a header.
I'm already using COOKIEJAR.
Please I hope someone can help us.
Thank you,
Douglas Fonseca

 
2008/1/1, Richard Lynch <ceo <at> l-i-e.com>:
On Mon, December 17, 2007 9:34 am, Werner Hofer wrote:
> I would like to use the curl library. I wish to get a content from a
> page
> (page x: http://www.travelan.net/module/20316/more-gesamt/).
> For that i call a page (page y:
> http://www.getyourstock.com/alfa13.php) and
> this page calls page x (see the example alfa13.php).
> Now the problem is following: There is an redirection whitin page x
> and i do
> not know how to get the content of the redirected page x
> The content of the redirected page x should be displayed finally in
> the
> browser.
> Result: I only get the header, but not the content of the page
> itselfs.
>
> The header i get is following:
>
> HTTP/1.1 302 Found Date: Mon, 17 Dec 2007 15:20:17 GMT Server:
> Apache/2.0.54
> (Debian GNU/Linux) PHP/5.2.3 with Suhosin-Patch DAV/2 mod_ssl/2.0.54
> OpenSSL/0.9.7e X-Powered-By: PHP/5.2.3 Set-Cookie:
> PHPSESSID=1vmqk1rfjgau42pvki54kl8je5; path=/ Expires: Thu, 19 Nov 1981
> 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate,
> post-check=0, pre-check=0 Pragma: no-cache location:
> http://www.holidayandmore.de/index.asp?Agentur=50376&AgentID=20316
> Transfer-Encoding: chunked Content-Type: text/html

Since you are getting cookies in the headers, perhaps you need to
provide a COOKIEJAR and COOKIEFILE for the redirects to work.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Ralph Seward | 3 Jan 20:24 2008
Picon

PDF links

Dear Folks,

I am currently developing a web bot using php/curl and I have a question to throw out. Many times I will come across a link to a pdf file that appears just like a link to a web page. For example, http://www.somesite/healthcenter/ImmunizationForm.pdf. Click on this link, and in Firefox a popup-like window will appear asking "What should Firefox do with this file?" with the options of Open or Save to Disk.
Now, is it possible to follow such a link through curl and have the pdf file saved to disk? Has anyone ever succeeded in doing anything with a pdf through curl?
Thanks in advance.
Ralph J Seward

Get the power of Windows + Web with the new Windows Live. Get it now!
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Gmane