Code Monkey home page Code Monkey logo

Comments (10)

momala454 avatar momala454 commented on May 9, 2024

nevermind, it was actually my fault, i've used curl_reset, which remove the parameters set using CURL_IMPERSONATE=chrome98

from curl-impersonate.

lwthiker avatar lwthiker commented on May 9, 2024

Alright, you also need to launch with the LD_PRELOAD env var to replace the default libcurl with libcurl-impersonate

from curl-impersonate.

momala454 avatar momala454 commented on May 9, 2024

i've modified the library file system wide so I don't need to prepend each execution of my script with LD_PRELOAD.

curl_reset is really useful because i'm reusing my connection between requests, and some parameters set on a previous request might not be useful on a following request.
Do you have an idea how to reset without resetting the settings that I can't configure from php ? Because i'm not sure how to properly reset everthing to their default value, like CURLOPT_COOKIEJAR or CURLOPT_PROXY, but I set many parameters, not only those two.
That's why curl_reset is useful for me

maybe curl_easy_reset could reset to the default curl_impersonate values ? https://github.com/curl/curl/blob/2610142139d14265ed9acf9ed83cdf73d6bb4d05/lib/easy.c#L959

from curl-impersonate.

lwthiker avatar lwthiker commented on May 9, 2024

I'll have to look how to change curl_easy_reset() so that the curl-impersonate options are preserved. Probably an internal call to curl_easy_impersonate() right after will do the trick but this has to be checked more thoroughly.

In the meantime, I guess you could just cleanup the handle and create a new one. Does curl_reset() actually preserve the connection or just saves you from destroying the old handle and creating a new one?

from curl-impersonate.

momala454 avatar momala454 commented on May 9, 2024

curl_reset keep the connection, so doing mutliple requests on the same website is much faster than closing and reiniting curl for each request

from curl-impersonate.

lwthiker avatar lwthiker commented on May 9, 2024

I see. Then patching curl_easy_reset() is probably the way to go. If you wanna give it a shot you are welcome - probably need to add something similar to this in the reset function. If not I'll have a look at this later.

from curl-impersonate.

lwthiker avatar lwthiker commented on May 9, 2024

@momala454 You may want to try #44. curl_easy_reset() is now patched as well, so that the necessary curl options for impersonation are retained (currently for the Chrome version only). I did some manual testing and it looks OK. Please test with your PHP app and let me know if it fixes the issue for you.

from curl-impersonate.

momala454 avatar momala454 commented on May 9, 2024

thank you, i will test this next week

from curl-impersonate.

momala454 avatar momala454 commented on May 9, 2024

i have a small problem with your pull request (actually, with the whole libcurl version). When i'm using CURL_IMPERSONATE=chrome98, i'm unable to overwrite the default user-agent header to Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
it stays with Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36

when I set CURLOPT_USERAGENT, it does not overwrite the default user-agent set with "CURL_IMPERSONATE" env variable. It only reset it if I modify the header "user-agent" using CURLOPT_HTTPHEADER

beside this small thing, the fix is working fine thank you

from curl-impersonate.

lwthiker avatar lwthiker commented on May 9, 2024

Got it, I'll open a separate issue for this. This one will be closed once I merge #44

from curl-impersonate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.