I need to do some standard functions that I always do manually, and I would like to automate this. I tested it with iframe , but without success, it does not read the document nodes.
I thought of using the cURL library, so I get the contents of the page (could be file_get_contents () ), the options return to the login page (including logged in, asking only to proceed) , but if I access the same page in my browser, it is not redirected to the login screen.
So the question, what to do to make the cURL request 100% identical to what I do in my regular browser, that is, if I did, I would go to the page I pointed, instead of logging back in.
Note: In cURL I have set CURLOPT_COOKIEFILE
to a .txt
file where you have cookies (which I make sure I am logged in) cURL back to login page (already logged in, just asking permission to continue)
I believe that the site somehow detects this, would it be some constant that I stopped defining in cURL ?
Here's how I set up cURL today:
$url = "http://trade.aliexpress.com/order_detail.htm?orderId=71064520859834";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_exec($ch);