public function destroy($id)
 {
     if ($id != Auth::id()) {
         return;
     }
     $contact = Contact::find($id);
     $name = ucwords("{$contact->first_name} {$contact->last_name}");
     $contact->delete();
     Curl::get($this->getAcUrl('contact_delete', ['id' => $contact->ac_id]));
     return (string) View::make('common.messages', ['messages' => "{$name} has been deleted."]);
 }
 /**
  * Returns the content of a page
  * @param string $url the URL that should be gathered
  * @return \Symfony\Component\HttpFoundation\Response
  * @throws GoogleSitemapParserException
  */
 protected function getContent($url)
 {
     if (!filter_var($url, FILTER_VALIDATE_URL)) {
         throw new GoogleSitemapParserException('Passed URL not valid according to filter_var function');
     }
     /** @var \Symfony\Component\HttpFoundation\Response $response */
     $response = Curl::get($url)[0];
     if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 400) {
         throw new GoogleSitemapParserException('The server responds with a bad status code: ' . $response->getStatusCode());
     }
     return $response->getContent();
 }
Example #3
0
 public function testPutWithData()
 {
     $responses = Curl::put('http://httpbin.org/put', array('foo' => 'bar', 'bar' => 'foo'));
     $this->assertInstanceOf('jyggen\\Curl\\Response', $responses[0]);
     $content = json_decode($responses[0]->getContent());
     $this->assertSame(JSON_ERROR_NONE, json_last_error());
     $this->assertSame('foo=bar&bar=foo', $content->data);
 }