windows - php curl 417 - Forventning mislykkedes postforespørgsel

Indlæg af Hanne Mølgaard Plasc

Problem



Jeg vil sende min $ data array til ip /crontab.php ..
nogle gange sit arbejde som hekseri. men for det meste mislykkes det med FEJL 417.


Array $ data er indstillet i alle felter.


VMWare Linux Debian 8.0 kan nås!


Her er min kode:


public function output($data)
{

    printr($data);

    $url = 'http:// <ip-VMWare> /crontab.php';

    $curl = curl\_init(); //Error 404
    curl\_setopt($curl, CURLOPT\_URL, $url); //return 1

    curl\_setopt($curl, CURLOPT\_RETURNTRANSFER, 1); //Error  404
    curl\_setopt($curl, CURLOPT\_POST, 1); //Error  417

    curl\_setopt($curl, CURLOPT\_POSTFIELDS, $data); //Error  417
    curl\_setopt($curl, CURLOPT\_REFERER, $url); //Error  417

    curl\_setopt($curl,CURLOPT\_HTTPHEADER,array("Expect:  ")); //Error  404
    curl\_setopt($curl, CURLOPT\_HTTPHEADER, array("HeaderName: HeaderValue")); //Error  417

    $response = curl\_exec($curl);
    print\_r($response);


    if($response === FALSE)
    {
        echo 'cURL ERROR: '.$response;
    }

    curl\_close($curl);

    exit; //stop the add process (only Testing the cURL)

    return 0;
}




<?php
//VMWare cronjob.php
echo 'ho';
if ($\_POST['Serverip'] === '0')
{echo 'ho';
    echo 'ho';}
print\_r($\_POST);

?>

Bedste reference