Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-16-2006, 02:58 PM   PM User | #1
gsnedders
Senior Coder

 
gsnedders's Avatar
 
Join Date: Jan 2004
Posts: 2,340
Thanks: 1
Thanked 7 Times in 7 Posts
gsnedders will become famous soon enough
Sending POST and GET with fsockopen

I've got the following function, but the GET is ignored, anyway to get any attention paid to it?

PHP Code:
<?php

function validate($data)
{
    
$fp fsockopen('validator.w3.org'80$errno$errstr30);
    if (!
$fp)
    {
        
trigger_error("Cannot open connection to validator.w3.org: $errstr ($errno)"E_USER_WARNING);
    }
    else
    {
        
$data rawurlencode($data);
        
$out "POST /check?;output=xml HTTP/1.0\r\n";
        
$out .= "Host: validator.w3.org\r\n";
        
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
        
$out .= 'Content-length: ' strlen($data) . "\r\n";
        
$out .= "Connection: Close\r\n\r\n";
        
fwrite($fp$out 'fragment=' $data);
        
$data '';
        while (!
feof($fp))
        {
            
$data .= fgets($fp1024);
        }
        echo 
trim(strstr($data"\r\n\r\n"));
    }
}

$test = <<<TEST
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<title>test</title>
<style type="text/css">
</style>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vitae dui eget diam blandit molestie. Nulla et nibh at tortor pharetra dignissim. Pellentesque in sapien ac nunc porta cursus. Maecenas nonummy. Fusce non est sed lacus iaculis egestas. Phasellus volutpat ultrices arcu. Integer non nibh. Nullam vitae purus. Ut at dui vitae eros dignissim tempor. Vestibulum congue eleifend orci. Nullam sem neque, convallis eleifend, imperdiet vel, iaculis quis, nunc. Phasellus tincidunt, nisl dignissim pellentesque fermentum, ante quam commodo leo, congue dapibus eros diam at lacus. Maecenas metus. Nulla sit amet diam ac risus consequat pulvinar. Integer placerat, purus venenatis porta ullamcorper, est lacus luctus felis, vitae laoreet nibh mi varius nisi. Nunc bibendum. Etiam pretium dapibus sapien. Ut pede sem, adipiscing eu, tincidunt sit amet, lacinia venenatis, tortor. Cras bibendum eros eu leo.<a href="&amp;test=test">test</a>
</p>
TEST;

validate($test);

?>
__________________
Geoffrey Sneddon
gsnedders is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:23 AM.


Advertisement
Log in to turn off these ads.