public function getChartImage(Chart $chart, $filename = null) { $res = $this->doRequest($this->buildQuery('/xml/getchartimage/'), $chart->getXmlPayload()); $imageurl = (string) $res->url; if ($filename) { $content = $this->httpRequest($imageurl); file_put_contents($filename . '.' . $chart->getFormat(), $content); } return $imageurl; }
public function getChartImage(Chart $chart, $filename = null) { $url = $this->buildQuery(sprintf('/json/pregnancy/%s/chartimage', $chart->getGrowchartid())); $res = $this->doRequest($url, $chart->toJson()); $imageurl = (string) $res->url; if ($filename) { $content = $this->httpRequest($imageurl); file_put_contents($filename . '.' . $chart->getFormat(), $content); } return $imageurl; }