cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

i need help about curl please !

From: Mr-Brain . <t__at_hotmail.fr>
Date: Wed, 13 Apr 2011 00:02:42 +0000

Hello,
I need some help on the curl.
sace the code on some file .php then upload it on some host.
My problem is i can't see the output words, because the link is variable as redirection.
 
<?php
$cookie=$cookie . ".txt";
$agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13";
function doRequest($method, $url, $referer, $agent, $cookie, $vars) {
    $ch=curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    if($referer != "") {
 curl_setopt($ch, CURLOPT_REFERER, $referer);
    }
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
    if ($method == 'POST') {
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
    }
    if (substr($url, 0, 5) == "https") {
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
    }
    $data = curl_exec($ch);
    curl_close($ch);
    if ($data) {
        return $data;
    } else {
        return curl_error($ch);
    }
}
function get($url, $referer, $agent, $cookie) {
    return doRequest('GET', $url, $referer, $agent, $cookie, 'NULL');
}
function post($url, $referer, $agent, $cookie, $vars) {
    return doRequest('POST', $url, $referer, $agent, $cookie, $vars);
}
 

    if(file_exists($cookie)){
 @unlink($cookie);
    }
    $data=get('https://easywebsoc.td.com/waw/idp/login.htm?execution=e1s1','',$agent,$cookie);
 echo $data;
?>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2011-04-13