Jump to content

Error with CURLOPT_POSTFIELDS


Shiftoii
 Share

Recommended Posts


Alright so as my title says I am working on trying to use curl to store the cookies of an item at the moment and fill out everything as listed.

 



<?php


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/purchased");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
//objekt array
$TStringError = array(
'storeId'   => 'ID',
'items'             => 'ID',
'pType'             => 'PType'
);
$cookies = array(
//detta ar dina inkops cookies
    'anx'           => 'UniqueCookie'
);


curl_setopt ($ch, CURLOPT_COOKIE,
//begagnade cookies ga hit
"Användar Cookies Go Here"


curl_setopt($ch, CURLOPT_POSTFIELDS, $TStringError);
$output = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string($output);
print_r($xml,1);
echo("done\n");
echo($output);
?>


I started messing with my code because of an XML error it was not sending properly and I still am not sure why I just randomly saved it again and I was getting a T String Error but if I was to remove any thing from the line that it's on it would just error out another error..

 



curl_setopt($ch, CURLOPT_POSTFIELDS, $TStringError);


This is what's giving me the error.. and if anyone could help me to know why it's not process the cookies properly.. that would be amazing.

 

Sorry for bad english.

Edited by Shiftoii
Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.