CodeRabbit CodeRabbit - 1 year ago 88
PHP Question

PHP error when trying to access Factual API

I am using WAMP for my PHP framework. I am trying to test this code

require_once "C:\wamp\www\factual-php-driver-master\Factual.php";
$factual= new Factual("/*API Key*/","/*API Secret*/");

$query= new FactualQuery;
$res= $factual->fetch("places", $query);

The PATH to my Factual.php file is absolutely correct but the file returns the following errors

Warning: require_once(C:\wamp\wwwactual-php-driver-master\Factual.php): failed to open stream: Invalid argument in C:\wamp\www\foodmeets\restaurants.php on line 2

Fatal error: require_once(): Failed opening required 'C:\wamp\wwwactual-php-driver-master\Factual.php' (include_path='.;C:\php\pear') in C:\wamp\www\foodmeets\restaurants.php on line 2

Please note I had performed the testing of the PHP install environment using the command

php -f test.php yourFactualKey yourFactualSecret [logfile]

as mentioned in the Factual Driver(V3) for PHP on Github(

Answer Source

you have to escape \f (The \f metacharacter is used to find a form feed character.)

require_once "C:\wamp\www\\factual-php-driver-master\Factual.php";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download