Giter VIP home page Giter VIP logo

multirequest's Issues

onRequestComplete в методе класа

Доброго времени суток. Подскажите пожалуйста как в метод onRequestComplete передать параметром функцию из этого же класа, array('this','RequestComplete'), не работает.

Add cURL Request Headers

Hello -

Love this library - can't thank you enough for it. However, I'm trying to find a way to send alternate header content types. For example, the URL I'm trying to query returns data in XML, and I would like to get the data back in JSON form. Their support has informed me I need to "pass the header value of
Content-Type: application/json; charset=utf-8"

I've tried modifying line 139 in Request.php
$this->addHeader('Content-Type: application/x-www-form-urlencoded; charset=' . $clientEncoding);

I've also tried adding an array element to the protected $headers variable in Request.php
protected $headers = array('Expect:','application/json');

but neither of these options seem to return the data in JSON.

Am I on the right track with my thinking, or is it something I need to get back in touch with their support? I would appreciate any guidance on this topic!

Thanks again!

mb_convert_encoding(): Illegal character encoding specified

Line 233 in Request.php

$this->responseContent is

string(188) "
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<link rel="stylesheet" type="text/css" href="int2.css">
</head>
<body>
B&#322;&#261;d. Brak numeru paczki.
</body></html>
"

$this->serverEncoding is string(5) "utf-8"

and

$clientEncoding is string(12) "windows-1250"

PHP 5.5.9-1ubuntu4.9 (cli)

Multi-thread connection pooling

Вопрос наверное даже не по либе, а по самому PHP. Если не сложно, подскажите.

Я знаю что CURL либа супортит шаринг TCP конекшенов и если нам нужно сделать N запросов, то мы может один раз сделать curl_init и после чего выполнять эти запросы, меняя только базовые параметры. Когда закончили - вызываем curl_close. В этом случае сама либа CURL будет юзать тот же самый TCP конекшен, который она открыла при первом запросе.

Но можно ли шарить эти конекшены между разными PHP реквестами ?

У меня есть сервер, на нём десятки сайтов. Каждая страница должна делать 1 запрос на сторонюю API. Будет ли эта логика тут работать ? Могут ли разные PHP реквесты обращаюсь в CURL либу, по сути шарить между собой конекшены или нет ?

И вообще реально ли такое сделать ?

Я знаю что PHP может работать в 2х режимах:

  • На каждый запрос создаётся отдельный процесс.
  • "Родитель"" создаёт несколько воркеров, между которыми распределяет эти самые реквесты. Воркеры по завершению работы не закрываются. И даже имеют внутренний кеш, в котором могут хранить различные данные (к примеру конекшены в БД)

Ведь если для каждого реквеста мне нужно делать запрос в АПИ, то количество сокетов возрастёт в два раза (на каждый реквест - запрос в АПИ). И поскольку сокеты система сразу не освобождает, то будет проблема в доступных сокетах.

Что Вы можете подсказать по этому вопросу ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.