tags:

views:

49

answers:

1

Hello

<?php
function query($url, $pfields = 0, $cookie = 0, $login = 0)
{
    if($ch = curl_init($url))
    {
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.5) Gecko/20091102 Firefox/3.9.0');   
        curl_setopt($ch, CURLOPT_HEADER, 1);
        if (!empty($pfields))
        {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $pfields);
        }            
        if (!empty($cookie))
        {
            curl_setopt($ch, CURLOPT_COOKIE, $cookie);            
        }            
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch,CURLOPT_ENCODING,'gzip');
        if (!$login)
        {
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        }
        $content = curl_exec($ch);
        return $content;
    }
}

$cookie = 'sessionID=3864cab58412ec567b634db3c317898;OAGEO=RU%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C;';
$p = '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++';
$post = 'clientid=23&campaignid=52&bannerid=111&appendsave=1&appendtype=0&append=' . urlencode($p) . '&submitbutton=';

echo query('http://site.com/in.php', $post, $cookie);

This code is returned 417 error( BUT $p is not usage urlencode but IS OK but +(plus) change for " "(space)

Sooooorry for my very bad english

+1  A: 

Try adding this:

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
konforce
Thank you!!!11!
Isis