note 117517 added to function.curl-init

From: Date: Tue, 23 Jun 2015 11:59:46 +0000
Subject: note 117517 added to function.curl-init
Groups: php.notes 
Request: Send a blank email to php-notes+get-202926@lists.php.net to get a copy of this message
Curl_init as well as CURLOPT_URL don't like to have static strings as parameter. I came across this by accident and it took me very long to find out. curl_exec will throw error 3 (Malformed) and you tipple check the URL in it's variable only to find by trial and error that it's declaration is the culprit. So never do this: static $someurl = "http://www.example.com/interfacce.php"; .... $ch=curl_init($someurl); .... $return=curl_exec($ch); Cheers ---- Server IP: 72.52.91.14 Probable Submitter: 62.154.164.2 ---- Manual Page -- http://php.net/manual/en/function.curl-init.php Edit -- https://master.php.net/note/edit/117517 Del: integrated -- https://master.php.net/note/delete/117517/integrated Del: useless -- https://master.php.net/note/delete/117517/useless Del: bad code -- https://master.php.net/note/delete/117517/bad+code Del: spam -- https://master.php.net/note/delete/117517/spam Del: non-english -- https://master.php.net/note/delete/117517/non-english Del: in docs -- https://master.php.net/note/delete/117517/in+docs Del: other reasons-- https://master.php.net/note/delete/117517 Reject -- https://master.php.net/note/reject/117517 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202926) next »