1

All, Viewers I have solved my last issue of API now I am facing one issue with Curl, I have try many ways like adding User-Agent Header etc. I guess I wrong somewhere, below I give my current code hope you guys can help me, by this code I can access from web-browser, issue with CLI

<?php
require_once 'bin/PHPCaller.php';


        $argv = array(basename(__FILE__, '.php'));
        $argv[] = "search";
        $argv[] = $_GET['mobile'] ;
        //print_r($argv);

        $phpCaller = new PHPCaller('apache2handler', $argv);
        $phpCaller->newLineCharacter = "\n";
        $phpCaller->tabCharacter = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        ob_start();
        $phpCaller->run(false);
        $response = ob_get_clean();
        $data = json_decode($response, TRUE);
        $name = $data['data'][0]['name'];
        $score = (floatval($data['data'][0]['score']) * 10);

        //echo $name . "<br /><br />" . $score;
        echo $score;

?>
PHP Lover
  • 19
  • 2

0 Answers0