Welcome Guest, Not a member yet? Register   Sign In
Help me with cURL
#1

[eluser]Twisted1919[/eluser]
Hi , i have a question regarding cURL , better say :
I want my users to submit only valid yahoo email addresses .
One way to do this is to talk with yahoo smtp server , but that's to slow , so i figure out a way to check the addresses right on yahoo register page . The problem is , that it works on windows but doesn't in linux .
Let me show you :
Code:
<?php
$email = '[email protected]';
$host = 'https://na.edit.yahoo.com/reg_json?PartnerName=yahoo_default&';
$host.= 'RequestVersion=1&AccountID;='.$email;
$host.= '&GivenName;=&FamilyName;=&ApiName=ValidateFields&intl=us&9149128;';

$options = array(
        CURLOPT_RETURNTRANSFER => true,         // return web page
        CURLOPT_HEADER         => false,        // don't return headers
        CURLOPT_FOLLOWLOCATION => true,         // follow redirects
        CURLOPT_ENCODING       => "",           // handle all encodings
        CURLOPT_USERAGENT      => "spider",     // who am i
        CURLOPT_REFERER           => "my.yahoo.com", //The referer ...
        CURLOPT_AUTOREFERER    => true,         // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,          // timeout on connect
        CURLOPT_TIMEOUT        => 120,          // timeout on response
        CURLOPT_MAXREDIRS      => 10,           // stop after 10 redirects
        CURLOPT_POST            => 0,            // i am NOT sending post data
        CURLOPT_POSTFIELDS     => '',    // this are my post vars
        CURLOPT_SSL_VERIFYHOST => 0,            // don't verify ssl
        CURLOPT_SSL_VERIFYPEER => false,        //
        CURLOPT_VERBOSE        => 1                //
    );

$ch      = curl_init($host);
curl_setopt_array($ch,$options);
$content = curl_exec($ch);
// $err     = curl_errno($ch);
// $errmsg  = curl_error($ch) ;
// $header  = curl_getinfo($ch);
curl_close($ch);
echo $content ;

?>

Ok , when the address is available , means that the inserted email doesn't exists .
The result is returned in json format , on success :
Code:
{"ResultCode":"SUCCESS"}
and on failure :
Code:
{"ResultCode":"PERMANENT_FAILURE","SuggestedIDList":["[email protected]","[email protected]","[email protected]"],"SuggestedDBIDList":["[email protected]","[email protected]"],"ErrorList":[{"ErrorCode":"100000","ErrorField":"AccountID"}]}

This is ok , works like a charm on windows , it's exactly what i need , and is a clean and fast solution .
But why this won't work on linux machines ?
Can anybody test this on linux/windows to see the results ?
#2

[eluser]kgill[/eluser]
I can't help with the problem but can I ask why you need to do this? It just seems like a lot of work for little gain.
#3

[eluser]Twisted1919[/eluser]
Because , i send ~12000 email weekly, every day i have at least 50 new users registering to my site , lots of them are so idiots and they will write dumb email addresses which are properly formatted but does not exist in yahoo servers .
So , try to imagine my email server which is a cheap VPS at 1Gb ram and 500 gb traffic , handling a mail queue of ~1000 emails which is rejected by yahoo servers , every time i send some newsletters to my users ...It's frustrating , and same time i don't like stupid users as them , they kill my server and i'm the one which pays for it .
Beside this , i just want to force them to insert true email addresses , maybe you will say to do something like OPT-IN service , but also , some of them are so dumb that i am sure they will not understand how it works .
Once again , this seems to be the fastest solution , but hey , if you have other solution to check if a email exists on yahoo servers , be my guest and explain me that method and i'll use it with my eyes closed .
#4

[eluser]kgill[/eluser]
Heh dealing with users who border on completely stupid is frustrating, my condolences. The only problem I see with your current idea is that even if they're valid email addresses they may not necessarily be the email address of the person registering. They've got a pretty good chance of hitting an existing email just making something up (especially when you start rejecting ones that don't exist) in which case you're going to end up flagged as spam by the legitimate account holders and then none of your newsletters will get through.

The only way you can be 100% sure it's a valid email is the now standard verification email for registering, they fill out the form, you send them an email with a link - they click the link to complete registration. If they can log in and click the link they're using a valid email, any unverified accounts you don't send stuff to and can drop after a reasonable time.
#5

[eluser]Twisted1919[/eluser]
I understand your ideea and seems the most valid one in these moments .
Maybe i'll try it , i don't know yet ...
#6

[eluser]jcavard[/eluser]
You should have a look at this library, it has a built-in email validation feature which is pretty well done.

DX Auth
http://dexcell.shinsengumiteam.com/dx_auth/




Theme © iAndrew 2016 - Forum software by © MyBB