I'm trying to write a script to scrape and autologin into a site. I could manage to scrape and log into the site using cURL but I'm facing a couple of problems:
- all the hyperlinks of my source get screwed. for eg. if I scrape www.sourcesite.com from www.mysite.com, all the links of www.sourcesite.com start pointing to www.mysite.com so www.sourcesite.com/page1.html becomes www.mysite.com/page1.html. How do I fix this?
- also, a direct login into www.sourcesite.com sets a cookie on user's machine and to handle that while trying to autologin, right now my script has the following lines, making the cookie getting dumped into cookie.txt.
curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
This works fine but this is not what I want. I want the cookie to be set on the user's machine under www.sourcesite.com's name. How do I implement that?
Any help would be greatly appreciated.