Comments (12)
You can instanciate the Rest-Request with some options as you can see here:
public function __construct(array $options = array())
{
$this->options = array(
self::USERAGENT => "ApaiIO [" . ApaiIO::VERSION . "]",
self::CONNECTION_TIMEOUT => 10,
self::TIMEOUT => 10,
self::FOLLOW_LOCATION => 1
);
$this->setOptions($options);
}
So with this you are able to disable CURLOPT_FOLLOWLOCATION.
$x = new Rest\Request(array(Request::FOLLOW_LOCATION => 0));
Now you have to pass $x to the configuration object.
from apai-io.
so i think this issue is closed now?
from apai-io.
that fixed it for me
from apai-io.
Thank you! That help me too.
from apai-io.
Hi, sorry if this is an old thread but I'm having the same issue.
How do I pass $x into the configuration object? I tried adding it like this:
$x = new Rest\Request(array(Request::FOLLOW_LOCATION => 0));
$conf = new GenericConfiguration($x);
try {
$conf
->setCountry('{omitted}')
->setAccessKey('{omitted}')
->setSecretKey('{omitted}')
->setAssociateTag('{omitted}');
} catch (\Exception $e) {
echo $e->getMessage();
}
$apaiIO = new ApaiIO($conf);
When I add that line you mentioned, I get this error:
Fatal error: Class 'Rest\Request' not found in {omitted} on line 45
Thanks for the help!
from apai-io.
First follow the installation instructions: http://exeu.github.io/apai-io/installation.html
After you've done this try this:
$x = new \ApaiIO\Request\Rest\Request(array(\ApaiIO\Request\Rest\Request::FOLLOW_LOCATION => 0));
try {
$conf
->setCountry('{omitted}')
->setAccessKey('{omitted}')
->setSecretKey('{omitted}')
->setAssociateTag('{omitted}')
->setRequest($x);
} catch (\Exception $e) {
echo $e->getMessage();
}
$apaiIO = new ApaiIO($conf);
from apai-io.
That worked! Thanks!
from apai-io.
I've got a client with the same problem. In my case I already added the FOLLOW_LOCATION 0:
$conf = new GenericConfiguration();
$x = new \ApaiIO\Request\Rest\Request(array(\ApaiIO\Request\Rest\Request::FOLLOW_LOCATION => 0));
try {
$conf
->setCountry($country)
->setAccessKey($aws_api_key)
->setSecretKey($aws_api_secret_key)
->setAssociateTag($aws_associate_tag)
//->setRequest('\ApaiIO\Request\Rest\Request')
//->setResponseTransformer('\ApaiIO\ResponseTransformer\XmlToDomDocument');
//->setRequest('\ApaiIO\Request\Soap\Request')
//->setResponseTransformer('\ApaiIO\ResponseTransformer\ObjectToArray');
->setRequest($x);
} catch (\Exception $e) {
echo $e->getMessage();
}
$amazon = new ApaiIO($conf);
but nethertheless his shared hosting returns the error:
PHP Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in /var/www/vhosts/.../libs/apai-io/exeu/apai-io/lib/ApaiIO/Request/Rest/Request.php on line 146
I followed the installation steps and my configuration is attached above. Any idea what it could be @Exeu ?
from apai-io.
In addition to my previous post, I tested a little bit around and found something interesting:
public function __construct(array $options = array())
{
$this->options = array(
self::USERAGENT => "ApaiIO [" . ApaiIO::VERSION . "]",
self::CONNECTION_TIMEOUT => 10,
self::TIMEOUT => 10,
self::FOLLOW_LOCATION => 0
);
$this->setOptions($options);
}
After setting the FOLLOW_LOCATION to 0 inside the constructor, the problem disappeared. Shouldn't be this setting be overwritten by the following line?
$x = new \ApaiIO\Request\Rest\Request(array(\ApaiIO\Request\Rest\Request::FOLLOW_LOCATION => 0));
from apai-io.
Yes it will ;) see setOptions function.
from apai-io.
Yeah but why does the error still occur? As I wrote CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set only disappears when I edit the Rest/Request.php constructor manually.
from apai-io.
Go ahead and grab a debugger. Step into it and investigate what is happening there in your case.
More i cannot do for you.
from apai-io.
Related Issues (20)
- AWS.Invalid (truncated...) HOT 5
- SignatureDoesNotMatch HOT 2
- Search for ASIN HOT 3
- 400 Bad Request - Request has expired HOT 1
- when no category defined, no results
- condition = 'used' should be 'Used'
- Question: Catching errors HOT 1
- Restricting "Similar" Results by Node
- how to use without composer? HOT 1
- GuzzleHttp\Exception\ServerException HOT 2
- Detailed Release Notes HOT 1
- amazon country
- Dynamically Insert Value base on User Request
- why does setPage have a limit of 10?
- Error 503 Service Unavailable HOT 6
- Problem when using in two plugins at the same time
- Technical question
- Product Advertising API 5.0 HOT 29
- RequestException.php throwing an error? HOT 1
- Guzzle 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apai-io.