Jump to content

issue with variable in post string.


denoteone

Recommended Posts

 

 

having issues with

echo curl_setopt($ch, CURLOPT_POSTFIELDS,"name='. $name  .'&email='.  $email .'&macs='.$mac_addresses.'&serial=".$serialnumber);

 

the thing is $mac_addresses  is a serialized array that should look like this

4a:4:{i:0;s:14:"98340234820384";i:1;s:16:"0980342883408230";i:2;s:11:"72843729374";i:3;s:16:"4209384082304980";}

 

but when I unserilize $mac_addressed and echo it I get

\'.a:4:{i:0;s:14:\"98340234820384\";i:1;s:16:\"0980342883408230\";i:2;s:11:\"72843729374\";i:3;s:16:\"4209384082304980\";}.\'

 

can anyone see what my issue is?

Link to comment
https://forums.phpfreaks.com/topic/213267-issue-with-variable-in-post-string/
Share on other sites

you're using an incorrect mix of single and double quotes, do either one or the other, not both:

 

url_setopt($ch, CURLOPT_POSTFIELDS,'name='. $name  .'&email='.  $email .'&macs='.$mac_addresses.'&serial='.$serialnumber);

 

or

 

url_setopt($ch, CURLOPT_POSTFIELDS,"name=$name&email=$email&macs=$mac_addresses&serial=$serialnumber");

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.