I'm trying to use curl to get a value but need some help. What I want is to check a url and if the value is null, try another url and return the value. This is all while using xml.
I see it has more memory, more storage, a better CPU, and a stylus, as you said.
Might be a good alternative. I see some refurbished for $150-200.
I'm not scared of refurnbished, as a lot of parts in my house are refurbished/used. All are working atm.
"TeamViewer is the fast, simple and friendly solution for remote access over the Internet"
Regarding the "friendly" description, has is stopped unceremoniusly booting your session after a couple of minutes accusing you of using it in a commercial environment?!
I hate religious supremacist genocidal maniacs. How antisemitic of you to imply that's what all Jews are like. Still no links I see. I guess when you're a zionists, backing your claims with proof doesn't matter. bEliEvE mE oR yOuRe hItLeR.
Question
DPyro
I'm trying to use curl to get a value but need some help. What I want is to check a url and if the value is null, try another url and return the value. This is all while using xml.
my code:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt($ch, CURLOPT_HTTPHEADER, array($contentlength)); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $inputdata); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); $data = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA); if ($xml->jid=="") { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $newUrl); curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt($ch, CURLOPT_HTTPHEADER, array($contentlength)); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $inputdata); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); $data = curl_exec($ch); curl_close($ch); $xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA); } if ($xml->id!="") { echo('jid:' . $xml->id . "<br/>"); } else { echo "id not found"; }EDIT: This works for now, but was hoping for less redundancy.
Edited by DPyroLink to comment
https://www.neowin.net/forum/topic/1000190-php-curl-and-multiple-urls/Share on other sites
2 answers to this question
Recommended Posts