B
B
bohdanNa2018-05-14 17:15:15
PHP
bohdanNa, 2018-05-14 17:15:15

How to solve the problem when authorizing OLX on a remote server?

There is an authorization function in olx using curl

$req = curl_init();
    $opt = array(
        CURLOPT_URL => 'https://www.olx.ua/account/?ref[0][action]=myaccount&ref[0][method]=index',
        CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
        CURLOPT_REFERER  => 'https://www.olx.ua',
        CURLOPT_SSL_VERIFYPEER => false,     // Disabled SSL Cert checks
        CURLOPT_SSL_VERIFYHOST => 0,
        CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1,//3,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_ENCODING => "",
        CURLOPT_AUTOREFERER => true,
        CURLOPT_CONNECTTIMEOUT => 120,
        CURLOPT_TIMEOUT => 120,
        CURLOPT_MAXREDIRS => 101,
        CURLOPT_COOKIE => $cookie,
        CURLOPT_COOKIEFILE => $cookie,
        CURLOPT_COOKIEJAR => $cookie,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS =>  $postArray,

    );
    curl_setopt_array($req, $opt);
    $returns = curl_exec($req);

var_dump($postArray);
array(3) {
  ["login[email_phone]"]=>
  string(23) "[email protected]"
  ["login[password]"]=>
  string(12) "11111111"
  ["login[remember-me]"]=>
  string(1) "1"
}

The code is working on a local machine
When I transfer it to a hosting, I get in response:
5af998f44cf02528481374.png
How to make it work on the server?
And I want to note that I tried on 3 different servers

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question