alexander's snippets

Update DynDns with CURL (php)

function doCurl($strDynURL){
    $ch=curl_init();
    curl_setopt($ch,CURLOPT_URL,$strDynURL);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_HTTPHEADER,array('User-Agent: Billion - VoIP/802.11g - 1.1'));
    $response = curl_exec($ch);
    curl_close($ch);
    return $response;
}

return yes or no if string found

SELECT IF(LENGTH(SUBSTRING('yo needle', instr('yo needle', 'needle'), LENGTH('yo needle')))>0,1,0) AS result