Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.12 KB

custom-request.md

File metadata and controls

49 lines (36 loc) · 1.12 KB

Custom request settings

Curl options

It is possible to add some additional Curl options for bot requests. For example, you can set proxy and User Agent like this:

$bot->getHttpClient()->setOptions([
    CURLOPT_PROXY => 'xx.xx.xxx.xx:xxxx',
    CURLOPT_PROXYTYPE => CURLPROXY_HTTP // Or CURLPROXY_SOCKS5,
    CURLOPT_USERAGENT => 'Your_User_Agent',
]);

Client info

With every request Pinterest returns an array with your current client info, with such info as OS, browser, IP and others:

$info = $bot->getClientInfo();

By default it uses client info from the last request. To reload client context pass true argument:

// Force to reload client info
$info = $bot->getClientInfo(true);

Current url

You can get an url of the last visited page:

$url = $bot->getHttpClient()->getCurrentUrl();

Visit page

Visit (click) a link. For example, when Pinterest sends you email with some link, and you want bot to visit it:

$bot->user->visitPage($url);