1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Alternative to including files remotely in PHP

Discussion in 'HTML, Graphics & Programming' started by toastyman, 25 Mar 2006.

  1. toastyman


    Joined: 30 Dec 2005

    Posts: 421

    Ok i've been building an API so users can connect to my site to get access to features etc. They put the parameters in the URL, and then use an include or require function to get the contents of that URL.

    For E.g.
    require_once("http://api.routehiker.escouts.net/?routecard&username=john smith&password=test");
    That would return some html and css, which would be printed on the user's page...

    In theory...

    I spoke to my host earlier, and all remote connections have been blocked for PHP. You can't access files remotely. Aaahh!

    Anyone had this kind of problem before...is there any way round it? Could it be done with Javascript?

    Hope someone can help ASAP!

  2. robmiller


    Joined: 26 Dec 2003

    Posts: 16,522

    Location: London

    You can probably still open regular sockets and thus use Snoopy. Typically, the syntax will be:

    require_once 'snoopy.php';
    // You can do anything you want with the results; here we echo them.
    echo $snoopy->results;
  3. toastyman


    Joined: 30 Dec 2005

    Posts: 421

    Spot on, will do the job nicely.

    Cheers Rob