| @@ 535-562 (lines=28) @@ | ||
| 532 | * |
|
| 533 | * @throws \Comodojo\Exception\HttpException |
|
| 534 | */ |
|
| 535 | public function send($data = null) { |
|
| 536 | ||
| 537 | try { |
|
| 538 | ||
| 539 | if ( $this->curl ) { |
|
| 540 | ||
| 541 | $this->init_curl($data); |
|
| 542 | ||
| 543 | $received = $this->send_curl(); |
|
| 544 | ||
| 545 | } else { |
|
| 546 | ||
| 547 | $this->init_stream($data); |
|
| 548 | ||
| 549 | $received = $this->send_stream(); |
|
| 550 | ||
| 551 | } |
|
| 552 | ||
| 553 | ||
| 554 | } catch (HttpException $ioe) { |
|
| 555 | ||
| 556 | throw $ioe; |
|
| 557 | ||
| 558 | } |
|
| 559 | ||
| 560 | return $received; |
|
| 561 | ||
| 562 | } |
|
| 563 | ||
| 564 | /** |
|
| 565 | * Init transport and get remote content |
|
| @@ 571-597 (lines=27) @@ | ||
| 568 | * |
|
| 569 | * @throws \Comodojo\Exception\HttpException |
|
| 570 | */ |
|
| 571 | public function get() { |
|
| 572 | ||
| 573 | try { |
|
| 574 | ||
| 575 | if ( $this->curl ) { |
|
| 576 | ||
| 577 | $this->init_curl(null); |
|
| 578 | ||
| 579 | $received = $this->send_curl(); |
|
| 580 | ||
| 581 | } else { |
|
| 582 | ||
| 583 | $this->init_stream(null); |
|
| 584 | ||
| 585 | $received = $this->send_stream(); |
|
| 586 | ||
| 587 | } |
|
| 588 | ||
| 589 | } catch (HttpException $ioe) { |
|
| 590 | ||
| 591 | throw $ioe; |
|
| 592 | ||
| 593 | } |
|
| 594 | ||
| 595 | return $received; |
|
| 596 | ||
| 597 | } |
|
| 598 | ||
| 599 | /** |
|
| 600 | * Reset the data channel for new request |
|