Find PHP application external calls -


let's have monolithic , huge codebase project written in php in localhost

is there service can report on runtime external calls made? code may using php directly or using curl instead.

maybe right approach not php application this, kind of daemon can give information operating system. using mac os x.

any ideas?

you can make use of observer pattern, classes exist in spl classes \splobserver , \splsubject. when have big project, surely have abstracted of , have wrappers curl calls , database etc (if not, should consider going according design patterns!).

class yourcurlwrapper implements \splsubject {     public function setobservers($observers) {         $this->observers = $observers;         return $this;     }     //notify observers(or of them)     public function notify() {         foreach ($this->observers $value) {             $value->update($this);         }     } } 

see classes splobserver , splsubject.

http://php.net/manual/de/class.splobserver.php

if external call outgoing network connection, can use ngrep or tcpdump collect outgoing or incoming traffic.

a third possibility, easiest , fastest, setup proxy (like squid). can see urls called in logfiles , don't have change php code. environment needs know proxy:

http_proxy http://localhost:3218 https_proxy http://localhost:3218 ftp_proxy http://localhost:3218 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -