Skip to content

Instantly share code, notes, and snippets.

@dennisdegryse
Forked from marwenblel/index.php
Last active August 29, 2015 14:12
Show Gist options
  • Save dennisdegryse/840631d07f0b7c41d480 to your computer and use it in GitHub Desktop.
Save dennisdegryse/840631d07f0b7c41d480 to your computer and use it in GitHub Desktop.
hello iam trying to excecute this php file with curl.
its start charging my browser and no response !!!
whats i miss here?
<?php
$url = 'http://apps.dev/flickr_app/index.php';
$data = <<<XML
<books>
<book>
<name>Book3</name>
<author>Auth3</author>
<isbn>ISBN0003</isbn>
</book>
<book>
<name>Book4</name>
<author>Auth4</author>
<isbn>ISBN0004</isbn>
</book>
</books>
XML;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
// curl_exec returns false in case of failure
if ($response === false)
$response = curl_error();
curl_close($ch);
echo $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment