Skip to content

Instantly share code, notes, and snippets.

@kevinAlbs
Created August 10, 2013 04:34
Show Gist options
  • Save kevinAlbs/6199065 to your computer and use it in GitHub Desktop.
Save kevinAlbs/6199065 to your computer and use it in GitHub Desktop.
<?php
$url = 'http://iris.comminfo.rutgers.edu/';
$parameters = "<parameters><requestType>fetch</requestType><resourceList><resource><id>1</id><url>http://www.amazon.com/s?ie=UTF8&amp;rh=n%3A283155%2Ck%3AFrance%20-%20History&amp;page=1</url></resource></resourceList></parameters>";
$data = array('xmldata' => $parameters);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment