Changeset 1446383
- Timestamp:
- 06/30/2016 09:28:11 AM (10 years ago)
- Location:
- bablic
- Files:
-
- 2 edited
-
tags/2.1/sdk.php (modified) (2 diffs)
-
trunk/sdk.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bablic/tags/2.1/sdk.php
r1432220 r1446383 66 66 private $version = ''; 67 67 private $meta = ''; 68 private $_body = ''; 69 private $pos = 0; 68 70 69 71 function __construct($options) { … … 489 491 } 490 492 493 public function write_buffer($ch,$fp,$len){ 494 $data = substr($this->_body, $this->pos, $len); 495 // increment $pos 496 $this->pos += strlen($data); 497 // return the data to send in the request 498 return $data; 499 } 500 491 501 private function send_to_bablic($url, $html) { 492 502 $bablic_url = "http://seo.bablic.com/api/engine/seo?site=$this->site_id&url=".urlencode($url).($this->subdir ? "&ld=subdir" : ""); 493 503 $curl = curl_init($bablic_url); 494 504 $length = strlen($html); 495 505 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 496 506 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 497 507 curl_setopt($curl, CURLOPT_HEADER, false); 498 508 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 499 curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: text/html", "Expect:"));509 curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: text/html", "Content-Length: $length","Expect:")); 500 510 curl_setopt($curl, CURLOPT_POST, true); 501 curl_setopt($curl, CURLOPT_POSTFIELDS, $html); 511 $this->_body = $html; 512 $this->pos = 0; 513 curl_setopt($curl, CURLOPT_READFUNCTION, array(&$this,'write_buffer')); 502 514 503 515 $response = curl_exec($curl); -
bablic/trunk/sdk.php
r1432220 r1446383 66 66 private $version = ''; 67 67 private $meta = ''; 68 private $_body = ''; 69 private $pos = 0; 68 70 69 71 function __construct($options) { … … 489 491 } 490 492 493 public function write_buffer($ch,$fp,$len){ 494 $data = substr($this->_body, $this->pos, $len); 495 // increment $pos 496 $this->pos += strlen($data); 497 // return the data to send in the request 498 return $data; 499 } 500 491 501 private function send_to_bablic($url, $html) { 492 502 $bablic_url = "http://seo.bablic.com/api/engine/seo?site=$this->site_id&url=".urlencode($url).($this->subdir ? "&ld=subdir" : ""); 493 503 $curl = curl_init($bablic_url); 494 504 $length = strlen($html); 495 505 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 496 506 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); 497 507 curl_setopt($curl, CURLOPT_HEADER, false); 498 508 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 499 curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: text/html", "Expect:"));509 curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-type: text/html", "Content-Length: $length","Expect:")); 500 510 curl_setopt($curl, CURLOPT_POST, true); 501 curl_setopt($curl, CURLOPT_POSTFIELDS, $html); 511 $this->_body = $html; 512 $this->pos = 0; 513 curl_setopt($curl, CURLOPT_READFUNCTION, array(&$this,'write_buffer')); 502 514 503 515 $response = curl_exec($curl);
Note: See TracChangeset
for help on using the changeset viewer.