K
K
Kirill Gorelov2016-06-20 19:25:17
PHP
Kirill Gorelov, 2016-06-20 19:25:17

How to send fl.ru post request to php?

Hello. I want to parse fl.ru.
But I can't pass the parameters I need to sort the tasks.
Now it shows me 403 Forbidden

$url = "https://www.fl.ru/projects/";
$post_data = array (
    "pf_keywords" => "php" // где php это слово для поиска
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// указываем, что у нас POST запрос
curl_setopt($ch, CURLOPT_POST, 1);
// добавляем переменные
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
echo $output;

What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor, 2016-06-21
@egormmm

See what headers the browser sends, and send them as well.

A
Anton B, 2016-06-20
@bigton

FL was not written by fools, I think they have protection from such bots.
You try to pretend to be a browser, accept a session cookie, pass a useragent, see what besides pf_keywords is sent in POST (using chrome).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question