teamplaylotto Posted June 2, 2007 Share Posted June 2, 2007 Hi, I'm having trouble parsing multiple pages in a curl session.. I am using curl to parse a page that requires a cookie, I can do that fine and store the information that I need using $result=curl_exec($ch); and then parsing $result after doing that, I want to go to another page and parse that one, I change the variable $url and then use curl_setopt($ch, CURLOPT_URL,$url); $result=curl_exec($ch); but $result is the same page as the first one :-( why am I getting the same contents for $result? hope you can help Andy Quote Link to comment https://forums.phpfreaks.com/topic/54046-parse-multiple-pages-with-curl-session/ Share on other sites More sharing options...
chigley Posted June 3, 2007 Share Posted June 3, 2007 Can you paste your entire code please? It should be working if you redefine the URL and execute it again. Quote Link to comment https://forums.phpfreaks.com/topic/54046-parse-multiple-pages-with-curl-session/#findComment-267345 Share on other sites More sharing options...
teamplaylotto Posted June 3, 2007 Author Share Posted June 3, 2007 thanks for responding chigley, seeing as you said it should work I went through the code a bit more and found out why I was getting the same page, coz I'm stupid!! I was putting $result into $rows by using explode() and parsing $rows to find the info, after the next curl_exec() I forgot to put the $result into $rows again so I was parsing the same array again and again, the $result was actually updating. It took me all morning to write a new script that can take my login details and then store the cookie after sending them to the login page and then going on to the prospects page, so I learned how to do that at least!! thats when I saw your message and looked back at my original code and found out what was wrong. doh! I'm using curl_setopt($ch, CURLOPT_COOKIE, 'cookiefrom livehttp headers'); after logging in to the site and copying the cookie contents from live http headers plugin and pasting it into the code which works as long I don't wait too long to run the script. on my new script, I tried to parse the login page of the site to get the captcha image and display it on a form and then when the form is submitted, pass the captcha details to the script that will then try and log in with a set username and password but I'm having problems with the captcha image, I can get it and display it but when the form is processed, it comes up with "wrong code number" which is probably because I parse the page and then call the image again so it would have changed. hmmmm, need to figure that out! thanks for answering Quote Link to comment https://forums.phpfreaks.com/topic/54046-parse-multiple-pages-with-curl-session/#findComment-267393 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.