Page 1 of 1

best way to send a remote request

Posted: Wed Jan 16, 2008 4:58 pm
by s.dot
Howdy partners,

I'm working on an api to a central database. I figured I could send an http request to a script of mine and have it output 1 or 0 (for true or false).

Code: Select all

public function check()
{
    return (bool) file_get_contents('http://www.example.com/check.php?user=' . $this->_user);
}
However this relies on the allow_url_fopen configuration in php.ini. How can I go about getting around that?

Re: best way to send a remote request

Posted: Wed Jan 16, 2008 6:53 pm
by RobertGonzalez
cURL perhaps?

Re: best way to send a remote request

Posted: Wed Jan 16, 2008 6:58 pm
by s.dot
that relies on the curl extension...

Re: best way to send a remote request

Posted: Wed Jan 16, 2008 6:59 pm
by RobertGonzalez
Something is going to have to rely on something. Even an Ajax call would rely on Javascript.

Maybe a shell command of ping or something?

Re: best way to send a remote request

Posted: Wed Jan 16, 2008 7:08 pm
by s.dot
Wow, I didn't realize allow_url_fopen was PHP_INI_ALL. This means I can just set it in the script.