PHP + Curl debugging, going mad

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
robokoder
Forum Newbie
Posts: 13
Joined: Wed Jan 04, 2006 9:23 am
Location: London, UK

PHP + Curl debugging, going mad

Post by robokoder »

:banghead:

Hello all,

I've been coding in PHP using Curl to navigate a website (not against terms of use), emulating a standard browser. Now I have a decent understanding of HTTP requests, and I've been using Tamper Data on Firefox for a clear record of all of the requests + responses involved in a particular action on the site in question. But applying these to the PHP script, everything seems to work fine (cookies set correctly etc, correct responses) until the final confirmation request, which fails for no good reason.

For privacy reasons, I'd prefer not to name the site and show the code publicly, and in any case it wouldn't be anything one can just 'look at' without running it yourself. However, if some kind soul with experience in these parts would offer just a few minutes to see if they can help me out, I'd be hugely grateful. It's nothing massive - about 7 requests involved - and, if I'm allowed to by forum rules, I'd be happy to make it up to you.

Cheers,

Dom
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP + Curl debugging, going mad

Post by requinix »

In forums you don't generally try to "compensate" people; the exception is the hire-a-programmer-style sites.
robokoder wrote:and in any case it wouldn't be anything one can just 'look at' without running it yourself.
Not necessarily... Experienced mechanics can take a problem description ("it squeaks") and test solutions.

Oh, and if something doesn't work then there's always a good reason.


So is there anything special about the last request? What does it involve?
robokoder
Forum Newbie
Posts: 13
Joined: Wed Jan 04, 2006 9:23 am
Location: London, UK

Re: PHP + Curl debugging, going mad

Post by robokoder »

tasairis wrote:In forums you don't generally try to "compensate" people; the exception is the hire-a-programmer-style sites.
robokoder wrote:and in any case it wouldn't be anything one can just 'look at' without running it yourself.
Not necessarily... Experienced mechanics can take a problem description ("it squeaks") and test solutions.

Oh, and if something doesn't work then there's always a good reason.


So is there anything special about the last request? What does it involve?
Thanks for the reply. I only meant a small gift or something, and only because helping me with this would probably require one-to-one contact which is more than you'd usually expect. But anyway, I realise there's a reason it's not working, but there isn't as of yet an obvious reason. The last request is just a GET request to the confirmation page. From Tamper Data, nothing is being sent over, so I presume they identify the user / details from the cookie. Firefox gets a 200 response, all good, while the script gets a temporary redirection to an error page.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP + Curl debugging, going mad

Post by requinix »

What does the error page say?

And if you delete your cookies (in Firefox) before viewing that last page, what happens?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: PHP + Curl debugging, going mad

Post by John Cartwright »

There is really not advice to give without getting ones hands dirty. Try running a HTTP proxy debugging tool such as Fiddler2 to compare the requests.
Post Reply