Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6047721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:22:54+00:00 2026-05-23T07:22:54+00:00

Ok so i have a curl request I am trying to make. $ch =

  • 0

Ok so i have a curl request I am trying to make.

$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://someurl.com/shop_pos/index.php?route=module/cart/ajax_get_all_products");

// Do a POST
$items = 
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_SESSION['cart']);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;

The contents or $_SESSION['cart'] is

Array
(
  [155] => 1
  [78] => 1
)

I need to send this data either as post data or a get variable…any suggestions

on the catching function

public function ajax_get_all_products(){
    $this->language->load('module/cart');
    $all_products = $this->cart->getProducts();
    $data_returned = json_encode($all_products);
    echo "<pre>".print_r($_REQUEST, true)."</pre>";
    echo "<pre>".print_r($_POST, true)."</pre>";
    $this->response->setOutput($data_returned, $this->config->get('config_compression'));
}

I dont get the array I set over. The two files are on the same server btw

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:22:55+00:00Added an answer on May 23, 2026 at 7:22 am

    try:

    curl_setopt($ch, CURLOPT_POSTFIELDS, array('items' => $_SESSION['cart']));
    

    try this:

    $post_data = http_build_query(array('items' => $_SESSION['cart']));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a cURL request to a https URL, but I have
I have a django view that returns HTTP 301 on a curl request: grapefruit:~
I am performing a curl request to a page. I have set both 'CURLOPT_TIMEOUT'
I am trying to send a request to an url like this http://mysite.dk/tværs?test=æ from
I have a program to send POST request to a server. I'm using cURL
I have a curl class, called Curl. Let's presume i have this code: $url
I am looking for HTTP parsing library for C/C++. I have looked curl library,
I have been trying to post login credentials to an https site using cURL
I am running a script on Amazon EC2 and trying to make a cURL
I'm trying to make a post request via ajax using jQuery (for the BaseCamp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.