Login to a web from CURL PHP

0

regards first of all I have a problem I am trying to start a session on this website link but I can not get the code to work and after starting I want to to go to the list of projects that is here link I would like to help me and thanks to this community every day we learn more with nothing more to say I leave the code

$username = 'Usuario';
$password = 'Pass';
$loginUrl = 'https://www.freelancer.es/login';

//init curl
$ch = curl_init();


curl_setopt($ch, CURLOPT_URL, $loginUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password);

curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$store = curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, "https://www.freelancer.es/search/projects");
$content = curl_exec($ch);
curl_close($ch);

    
asked by Johendry Parra 08.09.2018 в 13:22
source

1 answer

0

You need information. First that URL does not respond to the endpoint of the login, the only thing you have is the login that is very different. the URL is

  

link .

But there it does not end, the parameters that you are sending are not what the page asks for. I would recommend you better read their API and work from there

Freelancer API

    
answered by 08.09.2018 в 14:39