3 Nov 2003 16:23
Newbie PHP/Curl Problem
Alistair Ross <ali <at> woollyfoot.org>
2003-11-03 15:23:00 GMT
2003-11-03 15:23:00 GMT
Hi all,
I've written the following in PHP but my university aren't willing to
install the curl module for PHP so i need to make an external call to the
command line curl program. I've tried loads of ways but just can't get it
to behave in the same way as my PHP script does.
The PHP is:
<?php
$isbn="0446394319";
// use curl to retrieve the search results
$url =
"http://www.amazon.com/exec/obidos/search-handle-form/002-5640957-2809605";
$ch = curl_init(); // initialize curl handle
#curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL, $url); // set url
curl_setopt($ch, CURLOPT_FAILONERROR, 1); // it had better not error!
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirection
if url changes
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return it to a
variable
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // timeout of 3s just in case
curl_setopt($ch, CURLOPT_POST, 1); // set method to POST
curl_setopt($ch, CURLOPT_POSTFIELDS,
"url=index%3Dbooks&field-keywords=$isbn"); // add search string to
POST
(Continue reading)
RSS Feed