简体   繁体   English

在PHP中使用cURL中的cookie

[英]using cookies in cURL with php

I am trying to scrape a shopping website which shows pricing in different currency. 我正在尝试抓取一个购物网站,以不同的货币显示价格。

There is an drop down box to choose a currency type which calls the following line http://www.xxxx.com/find/setCurrency.jsp?code=INR 有一个下拉框可以选择一种货币类型,该货币类型调用以下行http://www.xxxx.com/find/setCurrency.jsp?code=INR

after clicking it redirects to its parent page. 单击后将其重定向到其父页面。 If I clear the cookie the prices are are back in USD 如果我清除了Cookie,价格将恢复为美元

I am working with cURL in PHP and simple_html_dom to scrape the products. 我正在使用PHPsimple_html_dom cURL来刮擦产品。 How can I find which cookie is responsible for the action and how can I use cookies in cURL 如何找到负责此操作的cookie,以及如何在cURL中使用cookie

You can use a Goolge Chrome extension Cookie Inspector to view add delete cookies. 您可以使用Goolge Chrome扩展程序Cookie检查器查看添加删除Cookie。

To find the one that is responsible for currency open that site, clear all cookies using the inspector, select the currency and see what cookie is set now. 要找到负责货币的那个,请打开该网站,使用检查器清除所有cookie,选择货币并查看现在设置了什么cookie。

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM