php - file_get_contents request taking over 5s with my local API? -



php - file_get_contents request taking over 5s with my local API? -

at moment i'm building api locally. hosted on virtual host http://api.example.local , i'm getting response url taking awful long time.

i'm making request external virtual host hosted locally http://www.anotherexample.dev/.

i'm on mamp server , here code below:

http://www.anotherexample.dev/

<?php class ajaxcontroller extends basecontroller{ public function initialiser(){ $data = file_get_contents('http://api.example.local/data/handler?a[foo]=bar&a[bar][]=1&a[bar][]=2&a[bar][]=3'); echo '<pre>'; print_r($data); die(); }

http://api.example.local/

<?php class apicontroller extends basecontroller{ public function datahandler(){ $input = input::all(); homecoming $input; die(); }

response - browser

{ a: { foo: "bar", shaun: [ "1" ], bar: [ "2", "3" ] } }

response - terminal (curl request) - curl -i http://www.anotherexample.dev/initialiser

http/1.1 200 ok date: tue, 04 nov 2014 19:36:29 gmt server: apache x-powered-by: php/5.5.10 content-length: 50 content-type: text/html <pre>{"a":{"foo":"bar","shaun":["1"],"bar":["2","3"]}}

so i'm getting right response it's taking around 5.11 seconds - give or take few milliseconds each time. how can create request quicker?

any help appreciated.

php api curl file-get-contents response-time

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -