Hi everyone, I am working on a wee small project using cURL.
From the documentation, it states
"The Server will HTTP POST a string in a parameter called (INCOMING)" to the given callback URL.

I know the list of parameters in the string as this is given in the documentation,
What I dont know how to do, is "echo" the value(s) of each parameter in the string.

I have tried using _POST

foreach($_POST as $key=>$value){
    echo $key, ' => ', $value, "<br/>\n";
}

$QueryID = $_POST['QueryID'];

if($QueryID) {
    echo '<p/>QueryID: ', $QueryID, "<br/>\n";
}

else {
    echo '<p>No ID parameter.</p>';
}

I have also tried using _GET

foreach($_GET as $key=>$value){
    echo $key, ' => ', $value, "<br/>\n";
}

$QueryID = $_GET['QueryID'];

if($QueryID) {
    echo '<p/>QueryID: ', $QueryID, "<br/>\n";
}

else {
    echo '<p>No ID parameter.</p>';
}

But I keep getting "No ID parameter"....
If someone could show me how to do this, I would be forever greatful :)

Hope someone can help...

Hi, I have even tried

    var_dump($_POST);
    var_dump($_GET);
    var_dump($incoming);
    var_dump($INCOMING);

But still no joy in seeing the values of the parameters...
Driving me nuts this....

Member Avatar
diafol

cURL can be used to SEND get or post data and the return data is then saved to the curl variable - not returned as post or get.

Here's an example of a straight scrape - without specifying any parameters (post or get):

$url = "http://www.daniweb.com";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$scraped_page = curl_exec($ch);
curl_close($ch);
echo $scraped_page;

Try that as a basis for getting data from a page. Once you get return data, then go at it to send parameters:

For an example of post:

http://davidwalsh.name/curl-post

It's not brilliant, but an example nonetheless.