Status
Not open for further replies.

skinner

Active Member
741
2010
59
5,170
Hi,

Can anyone help me to upload pics to fastpic.ru with php?

Thanks

I'm using this code but it return the main page:

PHP:
function curl($link, $postfields = '', $cookie = '', $refer = '')
{
set_time_limit(0);ini_set('max_execution_time', 0);
    $ch = curl_init($link);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
    if($refer)
    {
        curl_setopt($ch, CURLOPT_REFERER, $refer);
    }
    if($postfields)
    {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
    }
    if($cookie)
    {
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
    }
    $page = curl_exec($ch);
    //echo $page;
    return($page);
    curl_close($ch);
}

$link = "http://fastpic*****";            $postfields2 = array( 'file[]' => '@'.$imgpathPOST);            $postResult2 = curl ($link,$postfields2 );            print_r($postResult2);
 
Last edited:
2 comments
You need to post to /uploadmulti and pass the following:

* file[]=your_file
* uploading=1

It responds with a 'Refresh' header sending you to a session URI, rather than a usual HTTP 302 redirect. So parse the headers (from CURLOPT_HEADER => true) and request the specified URI.
 
Status
Not open for further replies.
Back
Top