You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is currently not implemented directly. However, I believe you can work around this by modifying the HttpClient used by the Diffbot class. It's just a Guzzle5 HTTPClient, so take it out with getHttpClient and change the headers you need, then set it again with setHttpClient. Some helpful docs could be these.
I'll look into this some more during the course of next week - currently, I'm writing the full client docs.
@steved1982 I know it's been a while since this has been dealt with, but the client now implements PSR-7, so you can set custom headers by simply tweaking the client instance you use. Details about what was done and why in the 1.0 update are here.
@Swader This actually doesn't work because you typehinted to the implementing class and not an interface, so we can't swap out the class on the fly.
I've attempted this using both Guzzle as well as HttpPlug's PluginClient instance. both of which fail.
An example:
1) App\Tests\TestCase\Products\Vendors\DiffbotVendorTest::testVendor
TypeError: Argument 1 passed to Swader\Diffbot\Diffbot::setHttpClient() must be an instance of Http\Client\Common\HttpMethodsClient or null, instance of Http\Client\Common\PluginClient given, called in /home/vagrant/phoenix/app/Products/Vendors/DiffbotVendor.php on line 269
/home/vagrant/phoenix/vendor/swader/diffbot-php-client/src/Diffbot.php:98
Diffbot allows Custom HTTP Headers like X-Forward-Cookie.
How can I set these using this system?
My current code is just:
$api = $diffbot->createProductAPI($_POST["siteURL"]);
The text was updated successfully, but these errors were encountered: