lundi 25 octobre 2021

Submitting comments with PHP (cURL)

<?php 
$mycurl = curl_init();
curl_setopt_array($mycurl, 
    [
        CURLOPT_URL => "https://example.com", 
        CURLOPT_RETURNTRANSFER => TRUE, 
        CURLOPT_TIMEOUT => 4, 
        CURLOPT_FOLLOWLOCATION => TRUE, 
        CURLOPT_POST => TRUE, 
        CURLOPT_POSTFIELDS => ["Name" => "Example", "Email" => "Example@gmail.com", "Comment" => "Example"]
    ]
);
$result = curl_exec($mycurl);
curl_close($mycurl); ?>

My code is wrong I know, I just want learn PHP. How can I fix my code? I want really simple thing. I just want to comment on the website with the information I sent.




Aucun commentaire:

Enregistrer un commentaire