using curl to sign up via php script

using curl to sign up via php script

by Gr3ggz Gr3ggz -
Number of replies: 0

Hello everyone smile

I've got one tiny question.

I'm trying to 'sign up' on a website (website2) via a php script on another website (website1).

In order to do that, I created a basic curl page :

    $post = "username=xxxxx&password=xxxx&email=xxxxx&email2=xxxxxx&firstname=xxxxxx&lastname=xxxxx&city=xxxxxx&country=FR";

   $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $linktowebsite2);

    curl_setopt($ch, CURLOPT_POST, 1);

    curl_setopt($ch, CURLOPT_HEADER, 1);

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);

    curl_setopt($ch, CURLOPT_VERBOSE, true);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

    curl_setopt($ch, CURLOPT_COOKIESESSION, true);

    curl_setopt($ch, CURLOPT_AUTOREFERER, true );

    $result = curl_exec($ch);

}}}

The result is :

upload completely sent off: 153 out of 153 bytes
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Date: Sun, 15 Feb 2015 20:00:19 GMT
< Server: Apache
< Set-Cookie: MoodleSession=5f0290290401d0cc32e128b1bfd90615; path=/

but then i can't login and there's no record in the DB.

If anyone got the same problem I'd be glad to here the answer smile

Thank you all for your time !

Average of ratings: -