Jump to content

Curl issue not posting


ballhogjoni

Recommended Posts

What is wrong with this curl code?

 

$post_url = "http://www.ddsfgfdre.com/signup/dbsignup.php?p=65f1764b8142e6efc4eaeb743d5ec99d&document_url=http%3A%2F%2Fdvcfn.ededfdns.info%2F&referer=http%3A%2F%2Ffacebook.com&FirstName=Chester&EmailAddress=sdgfsfg%40yahoo.com&phone1=345&phone2=321&phone3=9087&ZipCode=84660&Dezdfgount=%24500-%242500&ActionButton=Makefree";

$ch = curl_init();

print_r($post_url);

curl_setopt( $ch , CURLOPT_URL , $post_url); //the url

curl_setopt($ch, CURLOPT_FAILONERROR, 1);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable

curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s

curl_setopt($ch, CURLOPT_POST, true); // set POST method

$ret = curl_exec($ch);

curl_close($ch);

Link to comment
https://forums.phpfreaks.com/topic/176511-curl-issue-not-posting/
Share on other sites

well you have set CURLOPT_POST but passed nothing to post! (no CURLOPT_POSTFIELDS)

 

EDIT: example

 <?php
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,"http://localhost/posttest.php");
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, "Hello=World&Foo=Bar&PHP=Freak");
    curl_exec ($curl);
    curl_close ($curl);
?> 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.