Jump to content

using php sockets


pouncer

Recommended Posts

ok guys, I had a go at this but no luck!

 


<?php

$host = "www.onelook.com";

$fp = fsockopen($host, 80, $errno, $errdesc) or die("Connection to $host failed");



$request = "GET /w=cat&ls=a HTTP/1.0\r\n";

$request .= "Host: $host\r\n";

$request .=  "Accept-Language: en-us\r\n";

   $request .=  "Accept-Encoding: gzip, deflatez\r\n";

$request .= "Accept: */*\r\n\r\n";



fputs($fp, $request);



while(!feof($fp)){

  $page[] = fgets($fp, 1024);

}



fclose($fp);

echo "The server returned ".(count($page)). " Lines";



for($i=0; $i<count($page); $i++){

  echo $page[$i];

}

?>

 

 

 

Try to conect for e.g: http://www.onelook.com/?w=cat&ls=a

 

 

 

It just keeps giving me a 302 error. What I'm actually looking to do is to check on the right of the page where it says

 

 

 

Quick definitions (cat)

 

 

 

 

 

noun: feline mammal usually having thick soft fur and being unable to roar; domestic cats; wildcats

 

 

 

It it finds that the word is a noun and or an adjective, I just want it to return/halt and echo "Word is a noun" etc

 

 

 

can anyone help?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.