Results 1 to 10 of 10

Thread: PHP sockets - expert help perhaps needed.

Hybrid View

  1. #1
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: PHP sockets - expert help perhaps needed.

    That's just a GET request. You can use file_get_contents() (assuming URL wrappers are enabled), and construct the URL manually.

    Or is using sockets a requirement?

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    Re: PHP sockets - expert help perhaps needed.

    Thank you so much for your reply penegate (I posted this problem on many other php forums an no-one replied, vbforums was my last resort)

    Well, I already had a attempt at this. But it just keeps giving me a 302 response :s. Using sockets is not a requirement, but I would very much like to use sockets since I like to explore stuff.

    PHP Code:
    <?php
        $host 
    "www.onelook.com";
        
    $fp fsockopen($host80$errno$errdesc) or die("Connection to $host failed");
        
        
    $request "GET /w=cat&ls=a HTTP/1.1\r\n";
        
    $request .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n";
        
    $request .= "Referer: http://www.onelook.com/?w=cat&ls=a\r\n";
        
    $request .= "Accept-Language: en-us\r\n";
        
    $request .= "Accept-Encoding: gzip, deflate\r\n";
         
    $request .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\r\n";
        
    $request .= "Host: www.onelook.com\r\n";
        
    $request .= "Connection: Keep-Alive\r\n\r\n";
        
        
    fputs($fp$request);
        
        while(!
    feof($fp)){
            
    $page[] = fgets($fp1024);
        }
        
        
    fclose($fp);
        
        for(
    $i=0$i<count($page); $i++){
            echo 
    $page[$i] . "\n";
        }

    ?>
    Any ideas matey? I hope you are the one who can help me!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width