Foreign GET Query

is there a way to query a foreign php page without cURL like the following pseudo code?

$ip = 'xxx.eee.www.qqq';


..and have the value stuck inside $lookup?

maybe im off base here, but i thought there was a less involved way than using cURL ...

Who is Participating?

Improve company productivity with a Business Account.Sign Up

tolgaongConnect With a Mentor Commented:
first and second method needs allow_url_fopen true as ini set
third method can get all the data although allow url fopen false...



if(preg_match("/^http:\/\/([^\/]+)(.*)$/", $lookup, $matches)){
         $response ="";
         $thirbuffer = '';
         $host = $matches[1];
         $uri = $matches[2];

         $request = "GET $uri HTTP/1.0\r\n";
         $request .= "Host: $host\r\n";
         $request .= "User-Agent: Mozilla \r\n";
       $request .= "Connection: close\r\n\r\n";

         if($http = fsockopen($host, 80, $errno, $errstr, 5)){
                fwrite($http, $request);
                $timeout = time() + 5;
                while(time() < $timeout && !feof($http)) {
                    $response .= fgets($http, 4096);
                list($header, $thirbuffer) = preg_split("/\r?\n\r?\n/", $response, 2);                  
n8dogAuthor Commented:
interesting... got some sample applicable syntax?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.