@@ -313,24 +313,24 @@ |
||
| 313 | 313 | { |
| 314 | 314 | $apiBase = Pingpp::$apiBase; |
| 315 | 315 | switch ($errno) { |
| 316 | - case CURLE_COULDNT_CONNECT: |
|
| 317 | - case CURLE_COULDNT_RESOLVE_HOST: |
|
| 318 | - case CURLE_OPERATION_TIMEOUTED: |
|
| 319 | - $msg = "Could not connect to Pingpp ($apiBase). Please check your " |
|
| 320 | - . "internet connection and try again. If this problem persists, " |
|
| 321 | - . "you should check Pingpp's service status at " |
|
| 322 | - . "https://pingxx.com/status, or"; |
|
| 323 | - break; |
|
| 324 | - case CURLE_SSL_CACERT: |
|
| 325 | - case CURLE_SSL_PEER_CERTIFICATE: |
|
| 326 | - $msg = "Could not verify Pingpp's SSL certificate. Please make sure " |
|
| 327 | - . "that your network is not intercepting certificates. " |
|
| 328 | - . "(Try going to $apiBase in your browser.) " |
|
| 329 | - . "If this problem persists,"; |
|
| 330 | - break; |
|
| 331 | - default: |
|
| 332 | - $msg = "Unexpected error communicating with Pingpp. " |
|
| 333 | - . "If this problem persists,"; |
|
| 316 | + case CURLE_COULDNT_CONNECT: |
|
| 317 | + case CURLE_COULDNT_RESOLVE_HOST: |
|
| 318 | + case CURLE_OPERATION_TIMEOUTED: |
|
| 319 | + $msg = "Could not connect to Pingpp ($apiBase). Please check your " |
|
| 320 | + . "internet connection and try again. If this problem persists, " |
|
| 321 | + . "you should check Pingpp's service status at " |
|
| 322 | + . "https://pingxx.com/status, or"; |
|
| 323 | + break; |
|
| 324 | + case CURLE_SSL_CACERT: |
|
| 325 | + case CURLE_SSL_PEER_CERTIFICATE: |
|
| 326 | + $msg = "Could not verify Pingpp's SSL certificate. Please make sure " |
|
| 327 | + . "that your network is not intercepting certificates. " |
|
| 328 | + . "(Try going to $apiBase in your browser.) " |
|
| 329 | + . "If this problem persists,"; |
|
| 330 | + break; |
|
| 331 | + default: |
|
| 332 | + $msg = "Unexpected error communicating with Pingpp. " |
|
| 333 | + . "If this problem persists,"; |
|
| 334 | 334 | } |
| 335 | 335 | $msg .= " let us know at [email protected]."; |
| 336 | 336 | |
@@ -64,30 +64,30 @@ |
||
| 64 | 64 | if ($this->debug) $opts[CURLINFO_HEADER_OUT] = TRUE; |
| 65 | 65 | if ($this->user && $this->pass) $opts[CURLOPT_USERPWD] = "$this->user:$this->pass"; |
| 66 | 66 | switch ($name) { |
| 67 | - case 'get': |
|
| 68 | - $opts[CURLOPT_HTTPGET] = TRUE; |
|
| 69 | - break; |
|
| 70 | - case 'post': |
|
| 71 | - $opts[CURLOPT_POST] = TRUE; |
|
| 72 | - $opts[CURLOPT_POSTFIELDS] = $req_body; |
|
| 73 | - break; |
|
| 74 | - case 'put': |
|
| 75 | - $opts[CURLOPT_PUT] = TRUE; |
|
| 76 | - if (strlen($req_body)) { |
|
| 77 | - if ($buf = fopen('php://memory', 'w+')) { |
|
| 78 | - fwrite($buf, $req_body); |
|
| 79 | - fseek($buf, 0); |
|
| 80 | - $opts[CURLOPT_INFILE] = $buf; |
|
| 81 | - $opts[CURLOPT_INFILESIZE] = strlen($req_body); |
|
| 82 | - } else throw new Services_Twilio_TinyHttpException('unable to open temporary file'); |
|
| 83 | - } |
|
| 84 | - break; |
|
| 85 | - case 'head': |
|
| 86 | - $opts[CURLOPT_NOBODY] = TRUE; |
|
| 87 | - break; |
|
| 88 | - default: |
|
| 89 | - $opts[CURLOPT_CUSTOMREQUEST] = strtoupper($name); |
|
| 90 | - break; |
|
| 67 | + case 'get': |
|
| 68 | + $opts[CURLOPT_HTTPGET] = TRUE; |
|
| 69 | + break; |
|
| 70 | + case 'post': |
|
| 71 | + $opts[CURLOPT_POST] = TRUE; |
|
| 72 | + $opts[CURLOPT_POSTFIELDS] = $req_body; |
|
| 73 | + break; |
|
| 74 | + case 'put': |
|
| 75 | + $opts[CURLOPT_PUT] = TRUE; |
|
| 76 | + if (strlen($req_body)) { |
|
| 77 | + if ($buf = fopen('php://memory', 'w+')) { |
|
| 78 | + fwrite($buf, $req_body); |
|
| 79 | + fseek($buf, 0); |
|
| 80 | + $opts[CURLOPT_INFILE] = $buf; |
|
| 81 | + $opts[CURLOPT_INFILESIZE] = strlen($req_body); |
|
| 82 | + } else throw new Services_Twilio_TinyHttpException('unable to open temporary file'); |
|
| 83 | + } |
|
| 84 | + break; |
|
| 85 | + case 'head': |
|
| 86 | + $opts[CURLOPT_NOBODY] = TRUE; |
|
| 87 | + break; |
|
| 88 | + default: |
|
| 89 | + $opts[CURLOPT_CUSTOMREQUEST] = strtoupper($name); |
|
| 90 | + break; |
|
| 91 | 91 | } |
| 92 | 92 | try { |
| 93 | 93 | if ($curl = curl_init()) { |
@@ -26,20 +26,20 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct($arg = null) { |
| 28 | 28 | switch (true) { |
| 29 | - case $arg instanceof SimpleXmlElement: |
|
| 30 | - $this->element = $arg; |
|
| 31 | - break; |
|
| 32 | - case $arg === null: |
|
| 33 | - $this->element = new SimpleXmlElement('<Response/>'); |
|
| 34 | - break; |
|
| 35 | - case is_array($arg): |
|
| 36 | - $this->element = new SimpleXmlElement('<Response/>'); |
|
| 37 | - foreach ($arg as $name => $value) { |
|
| 38 | - $this->element->addAttribute($name, $value); |
|
| 39 | - } |
|
| 40 | - break; |
|
| 41 | - default: |
|
| 42 | - throw new Services_Twilio_TwimlException('Invalid argument'); |
|
| 29 | + case $arg instanceof SimpleXmlElement: |
|
| 30 | + $this->element = $arg; |
|
| 31 | + break; |
|
| 32 | + case $arg === null: |
|
| 33 | + $this->element = new SimpleXmlElement('<Response/>'); |
|
| 34 | + break; |
|
| 35 | + case is_array($arg): |
|
| 36 | + $this->element = new SimpleXmlElement('<Response/>'); |
|
| 37 | + foreach ($arg as $name => $value) { |
|
| 38 | + $this->element->addAttribute($name, $value); |
|
| 39 | + } |
|
| 40 | + break; |
|
| 41 | + default: |
|
| 42 | + throw new Services_Twilio_TwimlException('Invalid argument'); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |