best way to send a remote request

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

best way to send a remote request

Post 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?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: best way to send a remote request

Post by RobertGonzalez »

cURL perhaps?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: best way to send a remote request

Post by s.dot »

that relies on the curl extension...
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: best way to send a remote request

Post 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?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: best way to send a remote request

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply