mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2026-09-15 11:06:43 +00:00
Create docs/ folder with initial content
Add more documentation on the following topics: * Running `curl-impersonate` from the command line, including changing the HTTP headers when needed. * Using `libcurl-impersonate` in JS and PHP scripts.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# Using libcurl-impersonate in PHP scripts
|
||||
|
||||
It is possible to use libcurl-impersonate in PHP scripts instead of the original libcurl. PHP loads libcurl dynamically during runtime, which means that a different set of steps needs to be taken.
|
||||
|
||||
## On Linux
|
||||
|
||||
First, patch libcurl-impersonate and change its SONAME:
|
||||
```bash
|
||||
patchelf --set-soname libcurl.so.4 /path/to/libcurl-impersonate-chrome.so
|
||||
```
|
||||
|
||||
Then replace at runtime with:
|
||||
```bash
|
||||
LD_PRELOAD=/path/to/libcurl-impersonate-chrome.so CURL_IMPERSONATE=chrome101 php -r 'print_r(curl_version());'
|
||||
```
|
||||
|
||||
If successful you should see:
|
||||
```
|
||||
[ssl_version] => BoringSSL
|
||||
```
|
||||
(or NSS if the Firefox version is used)
|
||||
|
||||
## On macOS
|
||||
|
||||
On Mac, first rename `libcurl-impersonate-chrome.dylib` to `libcurl.4.dylib` and place in some directory, say `/usr/local/lib`. Then run php with the `DYLD_LIBRARY_PATH` env var pointing to that directory, for example:
|
||||
```
|
||||
DYLD_LIBRARY_PATH=/usr/local/lib php -r 'print_r(curl_version());'
|
||||
```
|
||||
|
||||
If successful you should see:
|
||||
```
|
||||
[ssl_version] => BoringSSL
|
||||
```
|
||||
Reference in New Issue
Block a user