PHP Curl Request Class, Initiating Proper Variables for Request Type? First Time OOPPHP Simple OOP ClassTimer class in PHP OOPCritique Request: PHP Request-Method ClassProper usage of OOP PHPPHP OOP Login ClassContent management system for mediaRequest class in PHPPHP Response WrapperPHP OOP API ClassPHP HTTP request class
How does one intimidate enemies without having the capacity for violence?
Why do I get two different answers for this counting problem?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
What is the word for reserving something for yourself before others do?
Are the number of citations and number of published articles the most important criteria for a tenure promotion?
Unable to deploy metadata from Partner Developer scratch org because of extra fields
How can bays and straits be determined in a procedurally generated map?
What doth I be?
Horror movie about a virus at the prom; beginning and end are stylized as a cartoon
Revoked SSL certificate
Add text to same line using sed
Rock identification in KY
Can a vampire attack twice with their claws using Multiattack?
What's that red-plus icon near a text?
What defenses are there against being summoned by the Gate spell?
Why can't we play rap on piano?
Does an object always see its latest internal state irrespective of thread?
DC-DC converter from low voltage at high current, to high voltage at low current
Can a Cauchy sequence converge for one metric while not converging for another?
Do I have a twin with permutated remainders?
Modeling an IP Address
Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?
Languages that we cannot (dis)prove to be Context-Free
Can you really stack all of this on an Opportunity Attack?
PHP Curl Request Class, Initiating Proper Variables for Request Type? First Time OOP
PHP Simple OOP ClassTimer class in PHP OOPCritique Request: PHP Request-Method ClassProper usage of OOP PHPPHP OOP Login ClassContent management system for mediaRequest class in PHPPHP Response WrapperPHP OOP API ClassPHP HTTP request class
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
First time creating and constructing a PHP Object Class from scratch/near-scratch. Currently not using any pre-built class frameworks (although highly considering using an already constructed class like php-curl-class as a composer dependency down the line).
<?php
// Define Constants, etc.
require_once '../includeclass.php';
class Curl
const cookieJar = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
public function get($url, $proxy = NULL)
$this->curl = curl_init($url);
$this->proxy = $proxy;
$this->setup($this->proxy);
return $this->request();
public function setup($proxy)
$this->headers = array();
$this->truncateCookie();
// Gets Random UserAgent (not included in post/review)
$this->ua = $this->getUA();
if ($proxy !== NULL)
$this->proxy = explode(':', $proxy) [0];
$this->proxyport = explode(':', $proxy) [1];
curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy);
curl_setopt($this->curl, CURLOPT_PROXYPORT, $this->proxyport);
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($this->curl, CURLOPT_TIMEOUT, 300);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($this->curl, CURLOPT_ENCODING, 1);
curl_setopt($this->curl, CURLOPT_COOKIESESSION, 1);
curl_setopt($this->curl, CURLOPT_COOKIEJAR, self::cookieJar);
curl_setopt($this->curl, CURLOPT_COOKIEFILE, self::cookieJar);
curl_setopt($this->curl, CURLOPT_USERAGENT, $this->ua);
curl_setopt($this->curl, CURLOPT_HTTPHEADER, array(
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Language:en-US,en;q=0.9',
'Cache-Control: max-age=0',
'Connection: keep-alive',
'Host: example.com'
));
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, array(
$this,
'headerCallback'
));
public function truncateCookie()
$cookie = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
$opencookiefile = @fopen($cookie, "r+");
if ($opencookiefile !== false)
ftruncate($opencookiefile, 0);
fclose($opencookiefile);
public function headerCallback($curl, $header)
$this->headers[] = $header;
$len = strlen($header);
$header = explode(':', $header, 2);
if (count($header) < 2) return $len;
$name = strtolower(trim($header[0]));
if (!array_key_exists($name, $this->headers)) $this->headers[$name] = [trim($header[1]) ];
else $this->headers[$name][] = trim($header[1]);
return $len;
public function request()
$this->curldata = curl_exec($this->curl);
$curlinfo = curl_getinfo($this->curl);
$respTime = $curlinfo['connect_time'];
$httpcode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
// Condition to Ensure curldata returns HTML
if (preg_match("//[a-z]*>/i", $this->curldata) != 0)
// Condition to match download_size vs downloaded_size to ensure curl completed
// entire request in full (only applicable on some URLs that do
// not have any encoding in headers and actually show the
// content-length in retrieved headers/headers array
if (isset($this->headers['content-length'][0]))
$download_size = (int)$this->headers['content-length'][0];
$downloaded_size = strlen($this->curldata);
if ($httpcode === 200 && $download_size === $downloaded_size)
curl_close($this->curl);
return $this->curldata;
if ($httpcode === 200)
curl_close($this->curl);
return $this->curldata;
echo "rnrn" . "Failed: " . curl_errno($this->curl) . "rnrn";
curl_close($this->curl);
return false;
// Extra I'm including, not shown in example below
// Recursive Loop to Retry Curl Request until a Valid Response
// (still need to modify to create a max attempts condition..)
public function curlLoop(curl $curl, $url)
$count = 0;
while (true)
$count++;
echo "rnrn#" . $count . ": " . $url . "rnrn";
outputFlush();
$html = $curl->get($url);
if ($html !== false)
break;
return $html;
// end Class
And I'm using it like such (only thing functions shown doesn't hit on is my curlLoop function, which I included just for fun mostly (still needs to work, so not particularly relevant for Review):
$curl = new Curl();
$resp = $curl->get($url, $proxy);
if ($resp === FALSE)
//curl response failed
return false;
else {
// do whatever, successful curl response --- $resp = $this->curldata
Happy with this so far, the code works as shown.
Couple of setbacks/issues I'm having, major point being (and question in point from title), how would I best manage/account for the myriad of different URLs being passed through?
As discussed in my comments in the class, some conditions are only applicable to certain URLs.
As of right now, my Class is unsupported if the content-length header is shown and the curl response has encoded request headers (which makes strlen($this->curldata);
a few kb bit less than what the headers display).
I want this here, as it has saved me a few times where the curl response was 200 but the request for some reason failed/did not download entirely.
Additionally, I'm a bit perplexed on how to add conditions for the proper headers. As you can see, the headers are hardwired to the url example.com
for all requests. This is of course a big issue as headers should be appropriated to certain URLs.
Lastly, the blanket public statement for all methods in the class is an obvious issue. I still need to go over method visibilities and do some testing, so comment on this or not.
Any reviews/comments very much appreciated.. mostly learning as I go so progress can be a bit rocky at times.
php object-oriented curl
$endgroup$
add a comment |
$begingroup$
First time creating and constructing a PHP Object Class from scratch/near-scratch. Currently not using any pre-built class frameworks (although highly considering using an already constructed class like php-curl-class as a composer dependency down the line).
<?php
// Define Constants, etc.
require_once '../includeclass.php';
class Curl
const cookieJar = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
public function get($url, $proxy = NULL)
$this->curl = curl_init($url);
$this->proxy = $proxy;
$this->setup($this->proxy);
return $this->request();
public function setup($proxy)
$this->headers = array();
$this->truncateCookie();
// Gets Random UserAgent (not included in post/review)
$this->ua = $this->getUA();
if ($proxy !== NULL)
$this->proxy = explode(':', $proxy) [0];
$this->proxyport = explode(':', $proxy) [1];
curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy);
curl_setopt($this->curl, CURLOPT_PROXYPORT, $this->proxyport);
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($this->curl, CURLOPT_TIMEOUT, 300);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($this->curl, CURLOPT_ENCODING, 1);
curl_setopt($this->curl, CURLOPT_COOKIESESSION, 1);
curl_setopt($this->curl, CURLOPT_COOKIEJAR, self::cookieJar);
curl_setopt($this->curl, CURLOPT_COOKIEFILE, self::cookieJar);
curl_setopt($this->curl, CURLOPT_USERAGENT, $this->ua);
curl_setopt($this->curl, CURLOPT_HTTPHEADER, array(
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Language:en-US,en;q=0.9',
'Cache-Control: max-age=0',
'Connection: keep-alive',
'Host: example.com'
));
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, array(
$this,
'headerCallback'
));
public function truncateCookie()
$cookie = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
$opencookiefile = @fopen($cookie, "r+");
if ($opencookiefile !== false)
ftruncate($opencookiefile, 0);
fclose($opencookiefile);
public function headerCallback($curl, $header)
$this->headers[] = $header;
$len = strlen($header);
$header = explode(':', $header, 2);
if (count($header) < 2) return $len;
$name = strtolower(trim($header[0]));
if (!array_key_exists($name, $this->headers)) $this->headers[$name] = [trim($header[1]) ];
else $this->headers[$name][] = trim($header[1]);
return $len;
public function request()
$this->curldata = curl_exec($this->curl);
$curlinfo = curl_getinfo($this->curl);
$respTime = $curlinfo['connect_time'];
$httpcode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
// Condition to Ensure curldata returns HTML
if (preg_match("//[a-z]*>/i", $this->curldata) != 0)
// Condition to match download_size vs downloaded_size to ensure curl completed
// entire request in full (only applicable on some URLs that do
// not have any encoding in headers and actually show the
// content-length in retrieved headers/headers array
if (isset($this->headers['content-length'][0]))
$download_size = (int)$this->headers['content-length'][0];
$downloaded_size = strlen($this->curldata);
if ($httpcode === 200 && $download_size === $downloaded_size)
curl_close($this->curl);
return $this->curldata;
if ($httpcode === 200)
curl_close($this->curl);
return $this->curldata;
echo "rnrn" . "Failed: " . curl_errno($this->curl) . "rnrn";
curl_close($this->curl);
return false;
// Extra I'm including, not shown in example below
// Recursive Loop to Retry Curl Request until a Valid Response
// (still need to modify to create a max attempts condition..)
public function curlLoop(curl $curl, $url)
$count = 0;
while (true)
$count++;
echo "rnrn#" . $count . ": " . $url . "rnrn";
outputFlush();
$html = $curl->get($url);
if ($html !== false)
break;
return $html;
// end Class
And I'm using it like such (only thing functions shown doesn't hit on is my curlLoop function, which I included just for fun mostly (still needs to work, so not particularly relevant for Review):
$curl = new Curl();
$resp = $curl->get($url, $proxy);
if ($resp === FALSE)
//curl response failed
return false;
else {
// do whatever, successful curl response --- $resp = $this->curldata
Happy with this so far, the code works as shown.
Couple of setbacks/issues I'm having, major point being (and question in point from title), how would I best manage/account for the myriad of different URLs being passed through?
As discussed in my comments in the class, some conditions are only applicable to certain URLs.
As of right now, my Class is unsupported if the content-length header is shown and the curl response has encoded request headers (which makes strlen($this->curldata);
a few kb bit less than what the headers display).
I want this here, as it has saved me a few times where the curl response was 200 but the request for some reason failed/did not download entirely.
Additionally, I'm a bit perplexed on how to add conditions for the proper headers. As you can see, the headers are hardwired to the url example.com
for all requests. This is of course a big issue as headers should be appropriated to certain URLs.
Lastly, the blanket public statement for all methods in the class is an obvious issue. I still need to go over method visibilities and do some testing, so comment on this or not.
Any reviews/comments very much appreciated.. mostly learning as I go so progress can be a bit rocky at times.
php object-oriented curl
$endgroup$
add a comment |
$begingroup$
First time creating and constructing a PHP Object Class from scratch/near-scratch. Currently not using any pre-built class frameworks (although highly considering using an already constructed class like php-curl-class as a composer dependency down the line).
<?php
// Define Constants, etc.
require_once '../includeclass.php';
class Curl
const cookieJar = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
public function get($url, $proxy = NULL)
$this->curl = curl_init($url);
$this->proxy = $proxy;
$this->setup($this->proxy);
return $this->request();
public function setup($proxy)
$this->headers = array();
$this->truncateCookie();
// Gets Random UserAgent (not included in post/review)
$this->ua = $this->getUA();
if ($proxy !== NULL)
$this->proxy = explode(':', $proxy) [0];
$this->proxyport = explode(':', $proxy) [1];
curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy);
curl_setopt($this->curl, CURLOPT_PROXYPORT, $this->proxyport);
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($this->curl, CURLOPT_TIMEOUT, 300);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($this->curl, CURLOPT_ENCODING, 1);
curl_setopt($this->curl, CURLOPT_COOKIESESSION, 1);
curl_setopt($this->curl, CURLOPT_COOKIEJAR, self::cookieJar);
curl_setopt($this->curl, CURLOPT_COOKIEFILE, self::cookieJar);
curl_setopt($this->curl, CURLOPT_USERAGENT, $this->ua);
curl_setopt($this->curl, CURLOPT_HTTPHEADER, array(
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Language:en-US,en;q=0.9',
'Cache-Control: max-age=0',
'Connection: keep-alive',
'Host: example.com'
));
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, array(
$this,
'headerCallback'
));
public function truncateCookie()
$cookie = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
$opencookiefile = @fopen($cookie, "r+");
if ($opencookiefile !== false)
ftruncate($opencookiefile, 0);
fclose($opencookiefile);
public function headerCallback($curl, $header)
$this->headers[] = $header;
$len = strlen($header);
$header = explode(':', $header, 2);
if (count($header) < 2) return $len;
$name = strtolower(trim($header[0]));
if (!array_key_exists($name, $this->headers)) $this->headers[$name] = [trim($header[1]) ];
else $this->headers[$name][] = trim($header[1]);
return $len;
public function request()
$this->curldata = curl_exec($this->curl);
$curlinfo = curl_getinfo($this->curl);
$respTime = $curlinfo['connect_time'];
$httpcode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
// Condition to Ensure curldata returns HTML
if (preg_match("//[a-z]*>/i", $this->curldata) != 0)
// Condition to match download_size vs downloaded_size to ensure curl completed
// entire request in full (only applicable on some URLs that do
// not have any encoding in headers and actually show the
// content-length in retrieved headers/headers array
if (isset($this->headers['content-length'][0]))
$download_size = (int)$this->headers['content-length'][0];
$downloaded_size = strlen($this->curldata);
if ($httpcode === 200 && $download_size === $downloaded_size)
curl_close($this->curl);
return $this->curldata;
if ($httpcode === 200)
curl_close($this->curl);
return $this->curldata;
echo "rnrn" . "Failed: " . curl_errno($this->curl) . "rnrn";
curl_close($this->curl);
return false;
// Extra I'm including, not shown in example below
// Recursive Loop to Retry Curl Request until a Valid Response
// (still need to modify to create a max attempts condition..)
public function curlLoop(curl $curl, $url)
$count = 0;
while (true)
$count++;
echo "rnrn#" . $count . ": " . $url . "rnrn";
outputFlush();
$html = $curl->get($url);
if ($html !== false)
break;
return $html;
// end Class
And I'm using it like such (only thing functions shown doesn't hit on is my curlLoop function, which I included just for fun mostly (still needs to work, so not particularly relevant for Review):
$curl = new Curl();
$resp = $curl->get($url, $proxy);
if ($resp === FALSE)
//curl response failed
return false;
else {
// do whatever, successful curl response --- $resp = $this->curldata
Happy with this so far, the code works as shown.
Couple of setbacks/issues I'm having, major point being (and question in point from title), how would I best manage/account for the myriad of different URLs being passed through?
As discussed in my comments in the class, some conditions are only applicable to certain URLs.
As of right now, my Class is unsupported if the content-length header is shown and the curl response has encoded request headers (which makes strlen($this->curldata);
a few kb bit less than what the headers display).
I want this here, as it has saved me a few times where the curl response was 200 but the request for some reason failed/did not download entirely.
Additionally, I'm a bit perplexed on how to add conditions for the proper headers. As you can see, the headers are hardwired to the url example.com
for all requests. This is of course a big issue as headers should be appropriated to certain URLs.
Lastly, the blanket public statement for all methods in the class is an obvious issue. I still need to go over method visibilities and do some testing, so comment on this or not.
Any reviews/comments very much appreciated.. mostly learning as I go so progress can be a bit rocky at times.
php object-oriented curl
$endgroup$
First time creating and constructing a PHP Object Class from scratch/near-scratch. Currently not using any pre-built class frameworks (although highly considering using an already constructed class like php-curl-class as a composer dependency down the line).
<?php
// Define Constants, etc.
require_once '../includeclass.php';
class Curl
const cookieJar = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
public function get($url, $proxy = NULL)
$this->curl = curl_init($url);
$this->proxy = $proxy;
$this->setup($this->proxy);
return $this->request();
public function setup($proxy)
$this->headers = array();
$this->truncateCookie();
// Gets Random UserAgent (not included in post/review)
$this->ua = $this->getUA();
if ($proxy !== NULL)
$this->proxy = explode(':', $proxy) [0];
$this->proxyport = explode(':', $proxy) [1];
curl_setopt($this->curl, CURLOPT_PROXY, $this->proxy);
curl_setopt($this->curl, CURLOPT_PROXYPORT, $this->proxyport);
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($this->curl, CURLOPT_TIMEOUT, 300);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($this->curl, CURLOPT_ENCODING, 1);
curl_setopt($this->curl, CURLOPT_COOKIESESSION, 1);
curl_setopt($this->curl, CURLOPT_COOKIEJAR, self::cookieJar);
curl_setopt($this->curl, CURLOPT_COOKIEFILE, self::cookieJar);
curl_setopt($this->curl, CURLOPT_USERAGENT, $this->ua);
curl_setopt($this->curl, CURLOPT_HTTPHEADER, array(
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Language:en-US,en;q=0.9',
'Cache-Control: max-age=0',
'Connection: keep-alive',
'Host: example.com'
));
curl_setopt($this->curl, CURLOPT_HEADERFUNCTION, array(
$this,
'headerCallback'
));
public function truncateCookie()
$cookie = ROOT_DIR . DS . 'assets' . DS . 'cookie.txt';
$opencookiefile = @fopen($cookie, "r+");
if ($opencookiefile !== false)
ftruncate($opencookiefile, 0);
fclose($opencookiefile);
public function headerCallback($curl, $header)
$this->headers[] = $header;
$len = strlen($header);
$header = explode(':', $header, 2);
if (count($header) < 2) return $len;
$name = strtolower(trim($header[0]));
if (!array_key_exists($name, $this->headers)) $this->headers[$name] = [trim($header[1]) ];
else $this->headers[$name][] = trim($header[1]);
return $len;
public function request()
$this->curldata = curl_exec($this->curl);
$curlinfo = curl_getinfo($this->curl);
$respTime = $curlinfo['connect_time'];
$httpcode = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);
// Condition to Ensure curldata returns HTML
if (preg_match("//[a-z]*>/i", $this->curldata) != 0)
// Condition to match download_size vs downloaded_size to ensure curl completed
// entire request in full (only applicable on some URLs that do
// not have any encoding in headers and actually show the
// content-length in retrieved headers/headers array
if (isset($this->headers['content-length'][0]))
$download_size = (int)$this->headers['content-length'][0];
$downloaded_size = strlen($this->curldata);
if ($httpcode === 200 && $download_size === $downloaded_size)
curl_close($this->curl);
return $this->curldata;
if ($httpcode === 200)
curl_close($this->curl);
return $this->curldata;
echo "rnrn" . "Failed: " . curl_errno($this->curl) . "rnrn";
curl_close($this->curl);
return false;
// Extra I'm including, not shown in example below
// Recursive Loop to Retry Curl Request until a Valid Response
// (still need to modify to create a max attempts condition..)
public function curlLoop(curl $curl, $url)
$count = 0;
while (true)
$count++;
echo "rnrn#" . $count . ": " . $url . "rnrn";
outputFlush();
$html = $curl->get($url);
if ($html !== false)
break;
return $html;
// end Class
And I'm using it like such (only thing functions shown doesn't hit on is my curlLoop function, which I included just for fun mostly (still needs to work, so not particularly relevant for Review):
$curl = new Curl();
$resp = $curl->get($url, $proxy);
if ($resp === FALSE)
//curl response failed
return false;
else {
// do whatever, successful curl response --- $resp = $this->curldata
Happy with this so far, the code works as shown.
Couple of setbacks/issues I'm having, major point being (and question in point from title), how would I best manage/account for the myriad of different URLs being passed through?
As discussed in my comments in the class, some conditions are only applicable to certain URLs.
As of right now, my Class is unsupported if the content-length header is shown and the curl response has encoded request headers (which makes strlen($this->curldata);
a few kb bit less than what the headers display).
I want this here, as it has saved me a few times where the curl response was 200 but the request for some reason failed/did not download entirely.
Additionally, I'm a bit perplexed on how to add conditions for the proper headers. As you can see, the headers are hardwired to the url example.com
for all requests. This is of course a big issue as headers should be appropriated to certain URLs.
Lastly, the blanket public statement for all methods in the class is an obvious issue. I still need to go over method visibilities and do some testing, so comment on this or not.
Any reviews/comments very much appreciated.. mostly learning as I go so progress can be a bit rocky at times.
php object-oriented curl
php object-oriented curl
asked 14 mins ago
Brian BrumanBrian Bruman
1134
1134
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f216959%2fphp-curl-request-class-initiating-proper-variables-for-request-type-first-time%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f216959%2fphp-curl-request-class-initiating-proper-variables-for-request-type-first-time%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown